forked from OSchip/llvm-project
PR19558: don't produce an "unused variable" warning for a variable template partial specialization.
llvm-svn: 207260
This commit is contained in:
parent
b0b3fcf6d3
commit
6c6ef822b0
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue