aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-05-14 16:41:31 +0000
committerDouglas Gregor <dgregor@apple.com>2009-05-14 16:41:31 +0000
commit501c5ce63c2ff54c103fbab8c1c45234d5a82a57 (patch)
treea223e4e598b2fe41abe14615a95b1b138e3e6ae0 /lib/Sema/SemaTemplate.cpp
parent7633ab80454147ab4892b8de5fd16582a1f221e8 (diff)
In C++, warn when something previously declared as a "struct" is later
declared as a "class", or vice-versa. This warning is under the control of -Wmismatched-tags, which is off by default. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71773 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r--lib/Sema/SemaTemplate.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 7190df107e..1453dcfe5e 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -461,7 +461,7 @@ Sema::ActOnClassTemplate(Scope *S, unsigned TagSpec, TagKind TK,
// the class-key shall agree in kind with the original class
// template declaration (7.1.5.3).
RecordDecl *PrevRecordDecl = PrevClassTemplate->getTemplatedDecl();
- if (!isAcceptableTagRedeclaration(PrevRecordDecl->getTagKind(), Kind)) {
+ if (!isAcceptableTagRedeclaration(PrevRecordDecl, Kind, KWLoc, *Name)) {
Diag(KWLoc, diag::err_use_with_wrong_tag)
<< Name
<< CodeModificationHint::CreateReplacement(KWLoc,
@@ -2026,9 +2026,9 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagKind TK,
case DeclSpec::TST_union: Kind = TagDecl::TK_union; break;
case DeclSpec::TST_class: Kind = TagDecl::TK_class; break;
}
- if (!isAcceptableTagRedeclaration(
- ClassTemplate->getTemplatedDecl()->getTagKind(),
- Kind)) {
+ if (!isAcceptableTagRedeclaration(ClassTemplate->getTemplatedDecl(),
+ Kind, KWLoc,
+ *ClassTemplate->getIdentifier())) {
Diag(KWLoc, diag::err_use_with_wrong_tag)
<< ClassTemplate
<< CodeModificationHint::CreateReplacement(KWLoc,
@@ -2182,9 +2182,9 @@ Sema::ActOnExplicitInstantiation(Scope *S, SourceLocation TemplateLoc,
case DeclSpec::TST_union: Kind = TagDecl::TK_union; break;
case DeclSpec::TST_class: Kind = TagDecl::TK_class; break;
}
- if (!isAcceptableTagRedeclaration(
- ClassTemplate->getTemplatedDecl()->getTagKind(),
- Kind)) {
+ if (!isAcceptableTagRedeclaration(ClassTemplate->getTemplatedDecl(),
+ Kind, KWLoc,
+ *ClassTemplate->getIdentifier())) {
Diag(KWLoc, diag::err_use_with_wrong_tag)
<< ClassTemplate
<< CodeModificationHint::CreateReplacement(KWLoc,