diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-03-18 18:20:05 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-03-18 18:20:05 +0000 |
commit | 2fc9bb9ce23aec06620745773d24e59944b87ffc (patch) | |
tree | 0726fa11e6594591f34578ba035ea82a69fc0393 /clang/lib/Sema/SemaExpr.cpp | |
parent | d652fd2996ce31dfd35dd2a9c58bf051ca7fff44 (diff) |
Notes
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 63d8d7506d035..04a7038d67548 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -13909,7 +13909,12 @@ void Sema::ActOnStmtExprError() { } ExprResult Sema::ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, - SourceLocation RPLoc) { // "({..})" + SourceLocation RPLoc) { + return BuildStmtExpr(LPLoc, SubStmt, RPLoc, getTemplateDepth(S)); +} + +ExprResult Sema::BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, + SourceLocation RPLoc, unsigned TemplateDepth) { assert(SubStmt && isa<CompoundStmt>(SubStmt) && "Invalid action invocation!"); CompoundStmt *Compound = cast<CompoundStmt>(SubStmt); @@ -13938,18 +13943,10 @@ ExprResult Sema::ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, } } - bool IsDependentContext = false; - if (S) - IsDependentContext = S->getTemplateParamParent() != nullptr; - else - // FIXME: This is not correct when substituting inside a templated - // context that isn't a DeclContext (such as a variable template). - IsDependentContext = CurContext->isDependentContext(); - // FIXME: Check that expression type is complete/non-abstract; statement // expressions are not lvalues. Expr *ResStmtExpr = - new (Context) StmtExpr(Compound, Ty, LPLoc, RPLoc, IsDependentContext); + new (Context) StmtExpr(Compound, Ty, LPLoc, RPLoc, TemplateDepth); if (StmtExprMayBindToTemp) return MaybeBindToTemporary(ResStmtExpr); return ResStmtExpr; |