diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-12-02 02:48:42 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-12-02 02:48:42 +0000 |
commit | 435e647a4145239fbbf77b09a8f1b4d8bf4cd47e (patch) | |
tree | 5a8c87bf719506ce6a773c86b098f4d93dfa2803 /clang/lib/AST/Decl.cpp | |
parent | a8c5d3af60e61614c1b5a4c8e203c85ada9203e9 (diff) | |
download | bcm5719-llvm-435e647a4145239fbbf77b09a8f1b4d8bf4cd47e.tar.gz bcm5719-llvm-435e647a4145239fbbf77b09a8f1b4d8bf4cd47e.zip |
PR35456: Track definedness of variable template specializations separately from
whether they have an initializer.
We cannot distinguish between a declaration of a variable template
specialization and a definition of one that lacks an initializer without this,
and would previously mistake the latter for the former.
llvm-svn: 319605
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r-- | clang/lib/AST/Decl.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 41c4fd0e6c0..29846b61010 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -2029,9 +2029,12 @@ VarDecl::isThisDeclarationADefinition(ASTContext &C) const { // A variable template specialization (other than a static data member // template or an explicit specialization) is a declaration until we // instantiate its initializer. - if (isa<VarTemplateSpecializationDecl>(this) && - getTemplateSpecializationKind() != TSK_ExplicitSpecialization) - return DeclarationOnly; + if (auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(this)) { + if (VTSD->getTemplateSpecializationKind() != TSK_ExplicitSpecialization && + !isa<VarTemplatePartialSpecializationDecl>(VTSD) && + !VTSD->IsCompleteDefinition) + return DeclarationOnly; + } if (hasExternalStorage()) return DeclarationOnly; |