diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2020-03-05 18:05:37 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2020-03-05 18:05:37 +0000 | 
| commit | d652fd2996ce31dfd35dd2a9c58bf051ca7fff44 (patch) | |
| tree | 79536ae10cf5fef47abfaa9f60f1537b0fe9cd29 /clang/lib/Sema/SemaExpr.cpp | |
| parent | 92d00d6a94bb341a1ed677031280e14863d4bb28 (diff) | |
Notes
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 16 | 
1 files changed, 12 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 29562615e5889..63d8d7506d035 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -13908,9 +13908,8 @@ void Sema::ActOnStmtExprError() {    PopExpressionEvaluationContext();  } -ExprResult -Sema::ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, -                    SourceLocation RPLoc) { // "({..})" +ExprResult Sema::ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, +                               SourceLocation RPLoc) { // "({..})"    assert(SubStmt && isa<CompoundStmt>(SubStmt) && "Invalid action invocation!");    CompoundStmt *Compound = cast<CompoundStmt>(SubStmt); @@ -13939,9 +13938,18 @@ Sema::ActOnStmtExpr(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); +  Expr *ResStmtExpr = +      new (Context) StmtExpr(Compound, Ty, LPLoc, RPLoc, IsDependentContext);    if (StmtExprMayBindToTemp)      return MaybeBindToTemporary(ResStmtExpr);    return ResStmtExpr;  | 
