diff options
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index cfe5daacdc3..427946ad7c7 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/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)); } |