From: Gabor Greif Date: Wed, 18 Mar 2009 20:12:58 +0000 (+0000) Subject: incorporate review comment (about the optimization when we have a non-typedependent... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=299e829512641ef07e996db626994c281f22e2de;p=clang incorporate review comment (about the optimization when we have a non-typedependent expression) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67226 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index cfe5daacdc..427946ad7c 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -839,8 +839,24 @@ TemplateExprInstantiator::VisitConditionalOperator(ConditionalOperator *E) { if (False.isInvalid()) return SemaRef.ExprError(); - return SemaRef.ActOnConditionalOp(E->getCond()->getLocEnd(), - E->getFalseExpr()->getLocStart(), + if (!E->isTypeDependent()) { + // Since our original expression was not type-dependent, we do not + // perform lookup again at instantiation time (C++ [temp.dep]p1). + // Instead, we just build the new conditional operator call expression. + Cond.release(); + True.release(); + False.release(); + // FIXME: Don't reuse the parts here. We need to instantiate them. + return SemaRef.Owned(new (SemaRef.Context) ConditionalOperator( + E->getCond(), + E->getTrueExpr(), + E->getFalseExpr(), + E->getType())); + } + + + return SemaRef.ActOnConditionalOp(/*FIXME*/E->getCond()->getLocEnd(), + /*FIXME*/E->getFalseExpr()->getLocStart(), move(Cond), move(True), move(False)); }