Fix handling of the GNU "t ? : f" extension to the conditional
operator in C++, and verify that template instantiation for the
condition operator does the right thing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72127 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateInstantiateExpr.cpp b/lib/Sema/SemaTemplateInstantiateExpr.cpp
index 9dda383..2589e30 100644
--- a/lib/Sema/SemaTemplateInstantiateExpr.cpp
+++ b/lib/Sema/SemaTemplateInstantiateExpr.cpp
@@ -427,13 +427,13 @@
   if (Cond.isInvalid())
     return SemaRef.ExprError();
 
-  // FIXME: use getLHS() and cope with NULLness
-  Sema::OwningExprResult True = Visit(E->getTrueExpr());
-  if (True.isInvalid())
+  Sema::OwningExprResult LHS = SemaRef.InstantiateExpr(E->getLHS(), 
+                                                       TemplateArgs);
+  if (LHS.isInvalid())
     return SemaRef.ExprError();
 
-  Sema::OwningExprResult False = Visit(E->getFalseExpr());
-  if (False.isInvalid())
+  Sema::OwningExprResult RHS = Visit(E->getRHS());
+  if (RHS.isInvalid())
     return SemaRef.ExprError();
 
   if (!E->isTypeDependent()) { 
@@ -442,15 +442,15 @@
     // Instead, we just build the new conditional operator call expression.
     return SemaRef.Owned(new (SemaRef.Context) ConditionalOperator(
                                                            Cond.takeAs<Expr>(),
-                                                           True.takeAs<Expr>(), 
-                                                           False.takeAs<Expr>(),
+                                                           LHS.takeAs<Expr>(), 
+                                                           RHS.takeAs<Expr>(),
                                                            E->getType()));
   }
 
 
   return SemaRef.ActOnConditionalOp(/*FIXME*/E->getCond()->getLocEnd(),
                                     /*FIXME*/E->getFalseExpr()->getLocStart(),
-                                    move(Cond), move(True), move(False));
+                                    move(Cond), move(LHS), move(RHS));
 }
 
 Sema::OwningExprResult