From bb791699c095edc3e8cfaeaba7a0fb513f8c8cf4 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Fri, 27 Sep 2013 22:14:40 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191572 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaTemplate.cpp | 3 +++ test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 065f75ea8a..79f6fb8f34 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -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(CanonType) && "type of non-dependent specialization is not a RecordType"); diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp index 8309219f50..21119398b2 100644 --- a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp +++ b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp @@ -19,9 +19,10 @@ enum [[deprecated]] e { E }; // expected-note {{declared here}} e my_enum; // expected-warning {{'e' is deprecated}} template class X {}; -template <> class [[deprecated]] X {}; +template <> class [[deprecated]] X {}; // expected-note {{declared here}} X x1; -X x2; // FIXME: no warning! +// FIXME: The diagnostic here could be much better by mentioning X. +X x2; // expected-warning {{'X' is deprecated}} template class [[deprecated]] X2 {}; template <> class X2 {}; -- 2.40.0