summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2013-09-27 22:14:40 +0000
committerChandler Carruth <chandlerc@gmail.com>2013-09-27 22:14:40 +0000
commit2acfb22d233a7cd467357f5e022fb0bcb612e44c (patch)
tree95fae8cfb671d3fecfdb461fae2ef92b3cfab7b7
parent7857d489a997a36bd49e5032cdaeabb7114e8627 (diff)
downloadbcm5719-llvm-2acfb22d233a7cd467357f5e022fb0bcb612e44c.tar.gz
bcm5719-llvm-2acfb22d233a7cd467357f5e022fb0bcb612e44c.zip
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
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp3
-rw-r--r--clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp5
2 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 065f75ea8a6..79f6fb8f34a 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/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<RecordType>(CanonType) &&
"type of non-dependent specialization is not a RecordType");
diff --git a/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp b/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
index 8309219f50f..21119398b2f 100644
--- a/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
+++ b/clang/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 <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> {};
OpenPOWER on IntegriCloud