diff options
author | Richard Smith <richard@metafoo.co.uk> | 2020-03-09 17:34:33 -0700 |
---|---|---|
committer | Hans Wennborg <hans@chromium.org> | 2020-03-12 12:10:24 +0100 |
commit | d9bd6e3c1943e03b783f11d9f2e224ff83f83a7b (patch) | |
tree | 16f09db3551e9ad0ed5a7f345d319442e6efd6ce /clang/lib/AST/ASTImporter.cpp | |
parent | 5e062819d5adeb2526f1b8393edf5a265bef1591 (diff) | |
download | bcm5719-llvm-d9bd6e3c1943e03b783f11d9f2e224ff83f83a7b.tar.gz bcm5719-llvm-d9bd6e3c1943e03b783f11d9f2e224ff83f83a7b.zip |
PR45083: Mark statement expressions as being dependent if they appear in
a dependent context.
This matches the GCC behavior.
We track the enclosing template depth when determining whether a
statement expression is within a dependent context; there doesn't appear
to be any other reliable way to determine this.
We previously assumed they were neither value- nor
instantiation-dependent under any circumstances, which would lead to
crashes and other misbehavior.
(cherry picked from commit 5c845c1c50ac89a6f12557d1571678f3d1432478)
Diffstat (limited to 'clang/lib/AST/ASTImporter.cpp')
-rw-r--r-- | clang/lib/AST/ASTImporter.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 1f2ce30398c..ab4e961dcd4 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -6724,8 +6724,9 @@ ExpectedStmt ASTNodeImporter::VisitStmtExpr(StmtExpr *E) { SourceLocation ToLParenLoc, ToRParenLoc; std::tie(ToSubStmt, ToType, ToLParenLoc, ToRParenLoc) = *Imp; - return new (Importer.getToContext()) StmtExpr( - ToSubStmt, ToType, ToLParenLoc, ToRParenLoc); + return new (Importer.getToContext()) + StmtExpr(ToSubStmt, ToType, ToLParenLoc, ToRParenLoc, + E->getTemplateDepth()); } ExpectedStmt ASTNodeImporter::VisitUnaryOperator(UnaryOperator *E) { |