]> granicus.if.org Git - clang/commitdiff
Emit an error noting that Clang does not support code generation for
authorDouglas Gregor <dgregor@apple.com>
Mon, 23 Aug 2010 14:50:27 +0000 (14:50 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 23 Aug 2010 14:50:27 +0000 (14:50 +0000)
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

index 4487f17f6045c57aed7e12c13af5e339ead8ea5a..49deb7b365a8cc0957b8664be09c48476b437912 100644 (file)
@@ -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");