"C++98 requires an accessible copy constructor for class %2 when binding "
"a reference to a temporary; was %select{private|protected}0">,
AccessControl, InGroup<BindToTemporaryCopy>;
-def err_access_base : Error<
+def err_access_base_ctor : Error<
"%select{base class|inherited virtual base class}0 %1 has %select{private|"
- "protected}3 %select{constructor|copy constructor|copy assignment operator|"
- "destructor}2">, AccessControl;
-def err_access_field: Error<
- "field of type %0 has %select{private|protected}2 %select{constructor|copy "
- "constructor|copy assignment operator|destructor}1">, AccessControl;
+ "protected}2 constructor">, AccessControl;
+def err_access_field_ctor : Error<
+ "field of type %0 has %select{private|protected}1 constructor">, AccessControl;
def err_access_ctor_field :
Error<"field of type %1 has %select{private|protected}2 constructor">,
def warn_unavailable_fwdclass_message : Warning<
"%0 maybe unavailable because receiver type is unknown">;
def note_unavailable_here : Note<
- "function has been explicitly marked %select{unavailable|deleted|deprecated}0 here">;
+ "function has been explicitly marked "
+ "%select{unavailable|deleted|deprecated}0 here">;
def warn_not_enough_argument : Warning<
"not enough variable arguments in %0 declaration to fit a sentinel">;
def warn_missing_sentinel : Warning <
InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
def err_redefinition : Error<"redefinition of %0">;
def err_definition_of_implicitly_declared_member : Error<
- "definition of implicitly declared %select{constructor|copy constructor|"
- "copy assignment operator|destructor}1">;
+ "definition of implicitly declared %select{default constructor|copy "
+ "constructor|copy assignment operator|destructor}1">;
def err_definition_of_explicitly_defaulted_member : Error<
- "definition of explicitly defaulted %select{constructor|copy constructor|"
- "copy assignment operator|destructor}0">;
+ "definition of explicitly defaulted %select{default constructor|copy "
+ "constructor|copy assignment operator|destructor}0">;
def err_redefinition_extern_inline : Error<
"redefinition of a 'extern inline' function %0 is not supported in "
"%select{C99 mode|C++}1">;
enum CXXSpecialMember {
CXXInvalid = -1,
- CXXConstructor = 0,
+ CXXDefaultConstructor = 0,
CXXCopyConstructor = 1,
CXXCopyAssignment = 2,
CXXDestructor = 3
break;
case InitializedEntity::EK_Base:
- AccessEntity.setDiag(PDiag(diag::err_access_base)
+ AccessEntity.setDiag(PDiag(diag::err_access_base_ctor)
<< Entity.isInheritedVirtualBase()
- << Entity.getBaseSpecifier()->getType()
- << getSpecialMember(Constructor));
+ << Entity.getBaseSpecifier()->getType());
break;
case InitializedEntity::EK_Member: {
const FieldDecl *Field = cast<FieldDecl>(Entity.getDecl());
- AccessEntity.setDiag(PDiag(diag::err_access_field)
- << Field->getType()
- << getSpecialMember(Constructor));
+ AccessEntity.setDiag(PDiag(diag::err_access_field_ctor)
+ << Field->getType());
break;
}
if (Ctor->isCopyConstructor())
return Sema::CXXCopyConstructor;
- return Sema::CXXConstructor;
+ if (Ctor->isDefaultConstructor())
+ return Sema::CXXDefaultConstructor;
}
if (isa<CXXDestructorDecl>(MD))
return Sema::CXXDestructor;
- assert(MD->isCopyAssignmentOperator() &&
- "Must have copy assignment operator");
- return Sema::CXXCopyAssignment;
+ if (MD->isCopyAssignmentOperator())
+ return Sema::CXXCopyAssignment;
+
+ llvm_unreachable("getSpecialMember on non-special member");
+ return Sema::CXXInvalid;
}
/// canRedefineFunction - checks if a function can be redefined. Currently,
if (!RDecl->hasTrivialCopyConstructor())
member = CXXCopyConstructor;
else if (!RDecl->hasTrivialDefaultConstructor())
- member = CXXConstructor;
+ member = CXXDefaultConstructor;
else if (!RDecl->hasTrivialCopyAssignment())
member = CXXCopyAssignment;
else if (!RDecl->hasTrivialDestructor())
case CXXInvalid:
break;
- case CXXConstructor:
+ case CXXDefaultConstructor:
if (RD->hasUserDeclaredConstructor()) {
typedef CXXRecordDecl::ctor_iterator ctor_iter;
for (ctor_iter ci = RD->ctor_begin(), ce = RD->ctor_end(); ci != ce;++ci){
bool (CXXRecordDecl::*hasTrivial)() const;
switch (member) {
- case CXXConstructor:
+ case CXXDefaultConstructor:
hasTrivial = &CXXRecordDecl::hasTrivialDefaultConstructor; break;
case CXXCopyConstructor:
hasTrivial = &CXXRecordDecl::hasTrivialCopyConstructor; break;
if (SetCtorInitializers(Constructor, 0, 0, /*AnyErrors=*/false) ||
Trap.hasErrorOccurred()) {
Diag(CurrentLocation, diag::note_member_synthesized_at)
- << CXXConstructor << Context.getTagDeclType(ClassDecl);
+ << CXXDefaultConstructor << Context.getTagDeclType(ClassDecl);
Constructor->setInvalidDecl();
return;
}
class Test1 { A a; }; // expected-error {{private member}}
void test1() {
- Test1 a;
+ Test1 a;
a = Test1(); // expected-note{{implicit default copy}}
}
private: A(const A &); // expected-note 2 {{declared private here}}
};
- class Test1 { A a; }; // expected-error {{field of type 'test6::A' has private copy constructor}}
+ class Test1 { A a; }; // expected-error {{field of type 'test6::A' has private 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 copy constructor}}
+ class Test2 : A {}; // expected-error {{base class 'test6::A' has private constructor}}
void test2(const Test2 &t) {
Test2 a = t; // expected-note{{implicit default copy}}
}
// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A { };
-A::A() { } // expected-error {{definition of implicitly declared constructor}}
+A::A() { } // expected-error {{definition of implicitly declared default constructor}}
struct B { };
B::B(const B&) { } // expected-error {{definition of implicitly declared copy constructor}}