diff options
author | ed <ed@FreeBSD.org> | 2009-06-23 14:50:21 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-06-23 14:50:21 +0000 |
commit | da468bf93e74598f985f4988936ee5ca2dc9a38c (patch) | |
tree | 64b43af65e97f7659637c9ac028e39af2e26b841 /lib/Sema/SemaTemplateInstantiateExpr.cpp | |
parent | 8927c19a5ed03bef55dac4b623688387bcc794dc (diff) | |
download | FreeBSD-src-da468bf93e74598f985f4988936ee5ca2dc9a38c.zip FreeBSD-src-da468bf93e74598f985f4988936ee5ca2dc9a38c.tar.gz |
Import Clang r73954.
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateExpr.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateExpr.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateExpr.cpp b/lib/Sema/SemaTemplateInstantiateExpr.cpp index bf19701..749fb58 100644 --- a/lib/Sema/SemaTemplateInstantiateExpr.cpp +++ b/lib/Sema/SemaTemplateInstantiateExpr.cpp @@ -714,9 +714,17 @@ TemplateExprInstantiator::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) { E->getSourceRange()); } - Sema::OwningExprResult Arg = Visit(E->getArgumentExpr()); - if (Arg.isInvalid()) - return SemaRef.ExprError(); + Sema::OwningExprResult Arg(SemaRef); + { + // C++0x [expr.sizeof]p1: + // The operand is either an expression, which is an unevaluated operand + // [...] + EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated); + + Arg = Visit(E->getArgumentExpr()); + if (Arg.isInvalid()) + return SemaRef.ExprError(); + } Sema::OwningExprResult Result = SemaRef.CreateSizeOfAlignOfExpr((Expr *)Arg.get(), E->getOperatorLoc(), @@ -949,6 +957,12 @@ TemplateExprInstantiator::VisitCXXTypeidExpr(CXXTypeidExpr *E) { E->getSourceRange().getEnd()); } + // We don't know whether the expression is potentially evaluated until + // after we perform semantic analysis, so the expression is potentially + // potentially evaluated. + EnterExpressionEvaluationContext Unevaluated(SemaRef, + Action::PotentiallyPotentiallyEvaluated); + OwningExprResult Operand = Visit(E->getExprOperand()); if (Operand.isInvalid()) return SemaRef.ExprError(); |