From 5d743fa747281dbecbc0d557035ca44f8a26a342 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Mon, 23 Aug 2010 14:50:27 +0000 Subject: Emit an error noting that Clang does not support code generation for the ternary operator without a left-hand side in C++ (PR7726), from Jean-Daniel Dupas! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111809 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprScalar.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CGExprScalar.cpp') diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 4487f17f60..49deb7b365 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -2058,7 +2058,12 @@ VisitConditionalOperator(const ConditionalOperator *E) { return Builder.CreateSelect(CondV, LHS, RHS, "cond"); } - + if (!E->getLHS() && CGF.getContext().getLangOptions().CPlusPlus) { + // Does not support GNU missing condition extension in C++ yet (see #7726) + CGF.ErrorUnsupported(E, "conditional operator with missing LHS"); + return llvm::UndefValue::get(ConvertType(E->getType())); + } + llvm::BasicBlock *LHSBlock = CGF.createBasicBlock("cond.true"); llvm::BasicBlock *RHSBlock = CGF.createBasicBlock("cond.false"); llvm::BasicBlock *ContBlock = CGF.createBasicBlock("cond.end"); -- cgit v1.2.3