diff options
| author | Anders Carlsson <andersca@mac.com> | 2010-04-25 00:52:09 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2010-04-25 00:52:09 +0000 |
| commit | 53e1ba948d218d8de028fa8c522ee1e903ee533a (patch) | |
| tree | cb41cc279a56fbd518b3a8472408cc94244f2812 /clang/lib/Sema/SemaDeclCXX.cpp | |
| parent | a1c94049c27bf41c6024a042a1c15f8c89174d09 (diff) | |
| download | bcm5719-llvm-53e1ba948d218d8de028fa8c522ee1e903ee533a.tar.gz bcm5719-llvm-53e1ba948d218d8de028fa8c522ee1e903ee533a.zip | |
Revert enough of my patches to fix self-host again :(
llvm-svn: 102289
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 0e6ebaecd49..eee85743868 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -1545,11 +1545,6 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, FieldDecl *Field, CXXBaseOrMemberInitializer *&CXXMemberInit) { if (ImplicitInitKind == IIK_Copy) { - // FIXME: We shouldn't return early here. The reason we do it is that - // we don't handle copying arrays. - CXXMemberInit = 0; - return false; - ParmVarDecl *Param = Constructor->getParamDecl(0); QualType ParamType = Param->getType().getNonReferenceType(); @@ -4203,16 +4198,25 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation, DeclContext *PreviousContext = CurContext; CurContext = CopyConstructor; - if (SetBaseOrMemberInitializers(CopyConstructor, 0, 0, /*AnyErrors=*/false)) { - Diag(CurrentLocation, diag::note_member_synthesized_at) - << CXXCopyConstructor << Context.getTagDeclType(ClassDecl); - CopyConstructor->setInvalidDecl(); - } else { - CopyConstructor->setUsed(); - } + // C++ [class.copy] p209 + // Before the implicitly-declared copy constructor for a class is + // implicitly defined, all the implicitly-declared copy constructors + // for its base class and its non-static data members shall have been + // implicitly defined. + for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(); + Base != ClassDecl->bases_end(); ++Base) { + CXXRecordDecl *BaseClassDecl + = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl()); + if (CXXConstructorDecl *BaseCopyCtor = + BaseClassDecl->getCopyConstructor(Context, TypeQuals)) { + CheckDirectMemberAccess(Base->getSourceRange().getBegin(), + BaseCopyCtor, + PDiag(diag::err_access_copy_base) + << Base->getType()); - // FIXME: Once we teach SetBaseOrMemberInitializers to copy fields, we can - // get rid of this code. + MarkDeclarationReferenced(CurrentLocation, BaseCopyCtor); + } + } for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(), FieldEnd = ClassDecl->field_end(); Field != FieldEnd; ++Field) { |

