summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-12-15 17:33:16 +0000
committerDouglas Gregor <dgregor@apple.com>2008-12-15 17:33:16 +0000
commita24cd4f35a640268a254fda52744672d6ecdb466 (patch)
tree13e1f26e3b71f93dacebfe0f099e9ac3c2efb733 /clang/lib/Sema/SemaDeclCXX.cpp
parenta7e139a3e6fdca21c2e85eaa5d3bddc7d51977cb (diff)
downloadbcm5719-llvm-a24cd4f35a640268a254fda52744672d6ecdb466.tar.gz
bcm5719-llvm-a24cd4f35a640268a254fda52744672d6ecdb466.zip
Don't double-destroy constructors defined out-of-line. This is a
half-solution; the real solution is coming when constructors and destructors are treated like all other functions by ActOnDeclarator. llvm-svn: 61037
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index c3e947d4321..1efb17408a7 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -1112,13 +1112,17 @@ Sema::DeclTy *Sema::ActOnConstructorDeclarator(CXXConstructorDecl *ConDecl) {
// Make sure this constructor is an overload of the existing
// constructors.
OverloadedFunctionDecl::function_iterator MatchedDecl;
- if (!IsOverload(ConDecl, ClassDecl->getConstructors(), MatchedDecl) &&
- CurContext == (*MatchedDecl)->getLexicalDeclContext()) {
- Diag(ConDecl->getLocation(), diag::err_constructor_redeclared)
- << SourceRange(ConDecl->getLocation());
- Diag((*MatchedDecl)->getLocation(), diag::note_previous_declaration)
- << SourceRange((*MatchedDecl)->getLocation());
- ConDecl->setInvalidDecl();
+ if (!IsOverload(ConDecl, ClassDecl->getConstructors(), MatchedDecl)) {
+ if (CurContext == (*MatchedDecl)->getLexicalDeclContext()) {
+ Diag(ConDecl->getLocation(), diag::err_constructor_redeclared)
+ << SourceRange(ConDecl->getLocation());
+ Diag((*MatchedDecl)->getLocation(), diag::note_previous_declaration)
+ << SourceRange((*MatchedDecl)->getLocation());
+ ConDecl->setInvalidDecl();
+ return 0;
+ }
+
+ // FIXME: Just drop the definition (for now).
return ConDecl;
}
@@ -1142,7 +1146,7 @@ Sema::DeclTy *Sema::ActOnConstructorDeclarator(CXXConstructorDecl *ConDecl) {
}
// Add this constructor to the set of constructors of the current
- // class.
+ // class.
ClassDecl->addConstructor(Context, ConDecl);
return (DeclTy *)ConDecl;
}
OpenPOWER on IntegriCloud