Fix a bug where we failed to diagnose class template specialization

uses.

This fixes one of the two remaining failures to implement [[deprecated]]
as specified for C++14.

llvm-svn: 191572
This commit is contained in:
Chandler Carruth 2013-09-27 22:14:40 +00:00
parent 7857d489a9
commit 2acfb22d23
2 changed files with 6 additions and 2 deletions

View File

@ -2092,6 +2092,9 @@ QualType Sema::CheckTemplateIdType(TemplateName Name,
Decl->setLexicalDeclContext(ClassTemplate->getLexicalDeclContext());
}
// Diagnose uses of this specialization.
(void)DiagnoseUseOfDecl(Decl, TemplateLoc);
CanonType = Context.getTypeDeclType(Decl);
assert(isa<RecordType>(CanonType) &&
"type of non-dependent specialization is not a RecordType");

View File

@ -19,9 +19,10 @@ enum [[deprecated]] e { E }; // expected-note {{declared here}}
e my_enum; // expected-warning {{'e' is deprecated}}
template <typename T> class X {};
template <> class [[deprecated]] X<int> {};
template <> class [[deprecated]] X<int> {}; // expected-note {{declared here}}
X<char> x1;
X<int> x2; // FIXME: no warning!
// FIXME: The diagnostic here could be much better by mentioning X<int>.
X<int> x2; // expected-warning {{'X' is deprecated}}
template <typename T> class [[deprecated]] X2 {};
template <> class X2<int> {};