diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-12-21 00:25:33 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-12-21 00:25:33 +0000 |
| commit | ed2974f3cf2b9af28d62a1959f7b7bced32fca9f (patch) | |
| tree | 2046dfb6b27f81a7f213bc2ba523fea77d9013df /clang/lib/Sema/SemaExpr.cpp | |
| parent | 1d8efaba7e9517c95a67f5ec589a8a1329b90a00 (diff) | |
| download | bcm5719-llvm-ed2974f3cf2b9af28d62a1959f7b7bced32fca9f.tar.gz bcm5719-llvm-ed2974f3cf2b9af28d62a1959f7b7bced32fca9f.zip | |
C++ constant expression handling: eagerly instantiate static const integral data
members of class templates so that their values can be used in ICEs. This
required reverting r105465, to get such instantiated members to be included in
serialized ASTs.
llvm-svn: 147023
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 65439032f2c..3a61fe50666 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -9526,7 +9526,12 @@ void Sema::MarkDeclarationReferenced(SourceLocation Loc, Decl *D) { // This is a modification of an existing AST node. Notify listeners. if (ASTMutationListener *L = getASTMutationListener()) L->StaticDataMemberInstantiated(Var); - PendingInstantiations.push_back(std::make_pair(Var, Loc)); + QualType T = Var->getType(); + if (T.isConstQualified() && !T.isVolatileQualified() && + T->isIntegralOrEnumerationType()) + InstantiateStaticDataMemberDefinition(Loc, Var); + else + PendingInstantiations.push_back(std::make_pair(Var, Loc)); } } |

