PR19558: don't produce an "unused variable" warning for a variable template partial specialization.

llvm-svn: 207260
This commit is contained in:
Richard Smith 2014-04-25 19:21:40 +00:00
parent b0b3fcf6d3
commit 6c6ef822b0
2 changed files with 13 additions and 1 deletions

View File

@ -9062,7 +9062,8 @@ Sema::FinalizeDeclaration(Decl *ThisDecl) {
AddPushedVisibilityAttribute(VD);
// FIXME: Warn on unused templates.
if (VD->isFileVarDecl() && !VD->getDescribedVarTemplate())
if (VD->isFileVarDecl() && !VD->getDescribedVarTemplate() &&
!isa<VarTemplatePartialSpecializationDecl>(VD))
MarkUnusedFileScopedDecl(VD);
// Now we have parsed the initializer and can update the table of magic

View File

@ -122,8 +122,19 @@ namespace PR19305 {
template<typename T> const int l = 0; // no warning
int b = l<int>;
// PR19558
template<typename T> const int o = 0; // no warning
template<typename T> const int o<T*> = 0; // no warning
int c = o<int*>;
template<> int o<void> = 0; // no warning
int d = o<void>;
// FIXME: It'd be nice to warn here.
template<typename T> int m = 0;
template<typename T> int m<T*> = 0;
template<> const int m<void> = 0; // expected-warning {{unused variable}}
}
namespace ctor_with_cleanups {