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">,
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;
}
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}}
}