]> granicus.if.org Git - clang/commitdiff
Fix a bug where we failed to diagnose class template specialization
authorChandler Carruth <chandlerc@gmail.com>
Fri, 27 Sep 2013 22:14:40 +0000 (22:14 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Fri, 27 Sep 2013 22:14:40 +0000 (22:14 +0000)
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
test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp

index 065f75ea8a607106718966eff7ca5c879d572299..79f6fb8f34a5e3540f9a3c7d6923b53e6c31d05a 100644 (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");
index 8309219f50fe0268846bf468dbb2e4ab4067903d..21119398b2f4fc8aa7d4303139abd91ce396996e 100644 (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> {};