diff options
author | Aaron Puchert <aaronpuchert@alice-dsl.net> | 2020-02-01 00:05:36 +0100 |
---|---|---|
committer | Aaron Puchert <aaronpuchert@alice-dsl.net> | 2020-02-01 00:06:03 +0100 |
commit | 27684ae66d5545f211c0ac4393d0ba2bf3b5b47c (patch) | |
tree | daf6ba6fd0468c97b19ba83446ccabd51f4be732 | |
parent | 64cb77b9469207799e570483dadc720dbf12c794 (diff) | |
download | llvm-27684ae66d5545f211c0ac4393d0ba2bf3b5b47c.zip llvm-27684ae66d5545f211c0ac4393d0ba2bf3b5b47c.tar.gz llvm-27684ae66d5545f211c0ac4393d0ba2bf3b5b47c.tar.bz2 |
Don't warn about missing declarations for partial template specializations
Summary: Just like templates, they are excepted from the ODR rule.
Reviewed By: aaron.ballman, rsmith
Differential Revision: https://reviews.llvm.org/D68923
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 1 | ||||
-rw-r--r-- | clang/test/SemaCXX/warn-missing-variable-declarations.cpp | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index e8589d3..2175361 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -12523,6 +12523,7 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) { var->getDeclContext()->getRedeclContext()->isFileContext() && var->isExternallyVisible() && var->hasLinkage() && !var->isInline() && !var->getDescribedVarTemplate() && + !isa<VarTemplatePartialSpecializationDecl>(var) && !isTemplateInstantiation(var->getTemplateSpecializationKind()) && !getDiagnostics().isIgnored(diag::warn_missing_variable_declarations, var->getLocation())) { diff --git a/clang/test/SemaCXX/warn-missing-variable-declarations.cpp b/clang/test/SemaCXX/warn-missing-variable-declarations.cpp index e2480fd..b50eeed 100644 --- a/clang/test/SemaCXX/warn-missing-variable-declarations.cpp +++ b/clang/test/SemaCXX/warn-missing-variable-declarations.cpp @@ -70,6 +70,8 @@ template<typename> int var_template = 0; template<typename> constexpr int const_var_template = 0; template<typename> static int static_var_template = 0; +template<typename T> int var_template<T*>; + template int var_template<int[1]>; int use_var_template() { return var_template<int[2]>; } template int var_template<int[3]>; |