Undo enough of r131143 to make private copy ctor diags say "copy constructor" again

llvm-svn: 131706
This commit is contained in:
Matt Beaumont-Gay 2011-05-19 23:44:42 +00:00
parent 2af60abad8
commit 6c307aee7b
3 changed files with 11 additions and 6 deletions

View File

@ -603,9 +603,10 @@ def ext_rvalue_to_reference_access_ctor : ExtWarn<
AccessControl, InGroup<BindToTemporaryCopy>;
def err_access_base_ctor : Error<
"%select{base class|inherited virtual base class}0 %1 has %select{private|"
"protected}2 constructor">, AccessControl;
"protected}3 %select{|copy }2constructor">, AccessControl;
def err_access_field_ctor : Error<
"field of type %0 has %select{private|protected}1 constructor">, AccessControl;
"field of type %0 has %select{private|protected}2 "
"%select{|copy }1constructor">, AccessControl;
def err_access_ctor_field :
Error<"field of type %1 has %select{private|protected}2 constructor">,

View File

@ -1425,13 +1425,17 @@ Sema::AccessResult Sema::CheckConstructorAccess(SourceLocation UseLoc,
case InitializedEntity::EK_Base:
AccessEntity.setDiag(PDiag(diag::err_access_base_ctor)
<< Entity.isInheritedVirtualBase()
<< Entity.getBaseSpecifier()->getType());
<< Entity.getBaseSpecifier()->getType()
<< (getSpecialMember(Constructor) ==
Sema::CXXCopyConstructor));
break;
case InitializedEntity::EK_Member: {
const FieldDecl *Field = cast<FieldDecl>(Entity.getDecl());
AccessEntity.setDiag(PDiag(diag::err_access_field_ctor)
<< Field->getType());
<< Field->getType()
<< (getSpecialMember(Constructor) ==
Sema::CXXCopyConstructor));
break;
}

View File

@ -224,12 +224,12 @@ namespace test6 {
private: A(const A &); // expected-note 2 {{declared private here}}
};
class Test1 { A a; }; // expected-error {{field of type 'test6::A' has private constructor}}
class Test1 { A a; }; // expected-error {{field of type 'test6::A' has private copy constructor}}
void test1(const Test1 &t) {
Test1 a = t; // expected-note{{implicit default copy}}
}
class Test2 : A {}; // expected-error {{base class 'test6::A' has private constructor}}
class Test2 : A {}; // expected-error {{base class 'test6::A' has private copy constructor}}
void test2(const Test2 &t) {
Test2 a = t; // expected-note{{implicit default copy}}
}