PR45083: Mark statement expressions as being dependent if they appear in
authorRichard Smith <richard@metafoo.co.uk>
Tue, 10 Mar 2020 00:34:33 +0000 (17:34 -0700)
committerRichard Smith <richard@metafoo.co.uk>
Tue, 10 Mar 2020 21:45:04 +0000 (14:45 -0700)
commit5c845c1c50ac89a6f12557d1571678f3d1432478
tree002b06e33659b67aeba53a6f0c4a621a15e920cb
parent200b20639ac2804318dee9fddfe79c7fea7bd623
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.
14 files changed:
clang/include/clang/AST/Expr.h
clang/include/clang/AST/Stmt.h
clang/include/clang/Sema/Sema.h
clang/include/clang/Sema/Template.h
clang/lib/AST/ASTImporter.cpp
clang/lib/Parse/ParseExpr.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/lib/Sema/TreeTransform.h
clang/lib/Serialization/ASTReaderStmt.cpp
clang/lib/Serialization/ASTWriterStmt.cpp
clang/test/SemaTemplate/dependent-expr.cpp