summaryrefslogtreecommitdiffstats
path: root/clang/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
commit8f003d0fa361cf2236764c724a2009329737e5da (patch)
treed761419830bf7fdced52a71b7a243f4ee8be6a26 /clang/lib/Sema/SemaTemplate.cpp
parent3d7e69f2c918b7128e4211f0b20ef7124bd46a5b (diff)
downloadbcm5719-llvm-8f003d0fa361cf2236764c724a2009329737e5da.tar.gz
bcm5719-llvm-8f003d0fa361cf2236764c724a2009329737e5da.zip
Make sure that we're diagnosing duplicate explicit instantiation definitions.
llvm-svn: 84189
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 8d7e199e7a8..730fea30b5a 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/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,
OpenPOWER on IntegriCloud