aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-10-15 18:07:02 +0000
committerDouglas Gregor <dgregor@apple.com>2009-10-15 18:07:02 +0000
commit583f33b8a9227bace1a77a15404b4c64dc619d69 (patch)
tree097b5462dd2e4cd2929898dc9a2a66c9768fd4b1 /lib/Sema/SemaTemplate.cpp
parent0a897e32a09d290aa5b375444fe33928e47168bb (diff)
Make sure that we're diagnosing duplicate explicit instantiation definitions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84189 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r--lib/Sema/SemaTemplate.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 8d7e199e7a..730fea30b5 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -3818,8 +3818,11 @@ Sema::ActOnExplicitInstantiation(Scope *S,
CheckExplicitInstantiationScope(*this, Record, NameLoc, true);
// Verify that it is okay to explicitly instantiate here.
- if (CXXRecordDecl *PrevDecl
- = cast_or_null<CXXRecordDecl>(Record->getPreviousDeclaration())) {
+ CXXRecordDecl *PrevDecl
+ = cast_or_null<CXXRecordDecl>(Record->getPreviousDeclaration());
+ if (!PrevDecl && Record->getDefinition(Context))
+ PrevDecl = Record;
+ if (PrevDecl) {
MemberSpecializationInfo *MSInfo = PrevDecl->getMemberSpecializationInfo();
bool SuppressNew = false;
assert(MSInfo && "No member specialization information?");
@@ -4065,6 +4068,9 @@ Sema::DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
}
FunctionDecl *PrevDecl = Specialization->getPreviousDeclaration();
+ if (!PrevDecl && Specialization->isThisDeclarationADefinition())
+ PrevDecl = Specialization;
+
if (PrevDecl) {
bool SuppressNew = false;
if (CheckSpecializationInstantiationRedecl(*this, D.getIdentifierLoc(), TSK,