diff options
-rw-r--r-- | lib/AST/DeclBase.cpp | 1 | ||||
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 20 |
2 files changed, 12 insertions, 9 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index 6ddb967a63..45ba794d6b 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -321,7 +321,6 @@ void Decl::swapAttrs(Decl *RHS) { void Decl::Destroy(ASTContext& C) { - if (ScopedDecl* SD = dyn_cast<ScopedDecl>(this)) { // Observe the unrolled recursion. By setting N->NextDeclarator = 0x0 diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index c3e947d432..1efb17408a 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/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; } |