def err_ms_property_expected_comma_or_rparen : Error<
"expected ',' or ')' at end of property accessor list">;
def err_ms_property_initializer : Error<
- "property declaration cannot have an in-class initializer">;
+ "property declaration cannot have a default member initializer">;
def warn_cxx20_compat_explicit_bool : Warning<
"this expression will be parsed as explicit(bool) in C++20">,
"%select{defaulted|deleted}0 function definitions are incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
-// C++11 in-class member initialization
+// C++11 default member initialization
def ext_nonstatic_member_init : ExtWarn<
- "in-class initialization of non-static data member is a C++11 extension">,
- InGroup<CXX11>;
+ "default member initializer for non-static data member is a C++11 "
+ "extension">, InGroup<CXX11>;
def warn_cxx98_compat_nonstatic_member_init : Warning<
- "in-class initialization of non-static data members is incompatible with C++98">,
- InGroup<CXX98Compat>, DefaultIgnore;
+ "default member initializer for non-static data members is incompatible with "
+ "C++98">, InGroup<CXX98Compat>, DefaultIgnore;
def ext_bitfield_member_init: ExtWarn<
"default member initializer for bit-field is a C++20 extension">,
InGroup<CXX20>;
"default member initializer for bit-field is incompatible with "
"C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
def err_incomplete_array_member_init: Error<
- "array bound cannot be deduced from an in-class initializer">;
+ "array bound cannot be deduced from a default member initializer">;
// C++11 alias-declaration
def ext_alias_declaration : ExtWarn<
def note_nontrivial_user_provided : Note<
"because %select{base class of |field of |}0type %1 has a user-provided "
"%sub{select_special_member_kind}2">;
-def note_nontrivial_in_class_init : Note<
+def note_nontrivial_default_member_init : Note<
"because field %0 has an initializer">;
def note_nontrivial_param_type : Note<
"because its parameter is %diff{of type $, not $|of the wrong type}2,3">;
"'constexpr' specifier">;
def err_in_class_initializer_non_constant : Error<
"in-class initializer for static data member is not a constant expression">;
-def err_in_class_initializer_not_yet_parsed : Error<
+def err_default_member_initializer_not_yet_parsed : Error<
"default member initializer for %1 needed within definition of enclosing "
"class %0 outside of member functions">;
-def note_in_class_initializer_not_yet_parsed : Note<
+def note_default_member_initializer_not_yet_parsed : Note<
"default member initializer declared here">;
-def err_in_class_initializer_cycle
+def err_default_member_initializer_cycle
: Error<"default member initializer for %0 uses itself">;
def ext_in_class_initializer_non_constant : Extension<
// brace-or-equal-initializer
if (CSM == Sema::CXXDefaultConstructor && FI->hasInClassInitializer()) {
if (Diagnose)
- S.Diag(FI->getLocation(), diag::note_nontrivial_in_class_init) << FI;
+ S.Diag(FI->getLocation(), diag::note_nontrivial_default_member_init)
+ << FI;
return false;
}
// constructor before the initializer is lexically complete will ultimately
// come here at which point we can diagnose it.
RecordDecl *OutermostClass = ParentRD->getOuterLexicalRecordContext();
- Diag(Loc, diag::err_in_class_initializer_not_yet_parsed)
+ Diag(Loc, diag::err_default_member_initializer_not_yet_parsed)
<< OutermostClass << Field;
- Diag(Field->getEndLoc(), diag::note_in_class_initializer_not_yet_parsed);
+ Diag(Field->getEndLoc(),
+ diag::note_default_member_initializer_not_yet_parsed);
// Recover by marking the field invalid, unless we're in a SFINAE context.
if (!isSFINAEContext())
Field->setInvalidDecl();
RecordDecl *PatternRD = Pattern->getParent();
RecordDecl *OutermostClass = PatternRD->getOuterLexicalRecordContext();
Diag(PointOfInstantiation,
- diag::err_in_class_initializer_not_yet_parsed)
+ diag::err_default_member_initializer_not_yet_parsed)
<< OutermostClass << Pattern;
- Diag(Pattern->getEndLoc(), diag::note_in_class_initializer_not_yet_parsed);
+ Diag(Pattern->getEndLoc(),
+ diag::note_default_member_initializer_not_yet_parsed);
Instantiation->setInvalidDecl();
return true;
}
return true;
if (Inst.isAlreadyInstantiating()) {
// Error out if we hit an instantiation cycle for this initializer.
- Diag(PointOfInstantiation, diag::err_in_class_initializer_cycle)
+ Diag(PointOfInstantiation, diag::err_default_member_initializer_cycle)
<< Instantiation;
return true;
}
__declspec(property(get=GetV,)) int V10; // expected-error {{expected 'get' or 'put' in property declaration}}
__declspec(property(get=GetV,put=SetV)) int V11; // no-warning
__declspec(property(get=GetV,put=SetV,get=GetV)) int V12; // expected-error {{property declaration specifies 'get' accessor twice}}
- __declspec(property(get=GetV)) int V13 = 3; // expected-error {{property declaration cannot have an in-class initializer}}
+ __declspec(property(get=GetV)) int V13 = 3; // expected-error {{property declaration cannot have a default member initializer}}
int GetV() { return 123; }
void SetV(int v) {}
class PR20760_a {
int a = ); // expected-error {{expected expression}}
#if __cplusplus <= 199711L
- // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}}
+ // expected-warning@-2 {{default member initializer for non-static data member is a C++11 extension}}
#endif
int b = }; // expected-error {{expected expression}}
#if __cplusplus <= 199711L
- // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}}
+ // expected-warning@-2 {{default member initializer for non-static data member is a C++11 extension}}
#endif
int c = ]; // expected-error {{expected expression}}
#if __cplusplus <= 199711L
- // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}}
+ // expected-warning@-2 {{default member initializer for non-static data member is a C++11 extension}}
#endif
};
class PR20760_b {
int d = d); // expected-error {{expected ';'}}
#if __cplusplus <= 199711L
- // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}}
+ // expected-warning@-2 {{default member initializer for non-static data member is a C++11 extension}}
#endif
int e = d]; // expected-error {{expected ';'}}
#if __cplusplus <= 199711L
- // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}}
+ // expected-warning@-2 {{default member initializer for non-static data member is a C++11 extension}}
#endif
int f = d // expected-error {{expected ';'}}
#if __cplusplus <= 199711L
- // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}}
+ // expected-warning@-2 {{default member initializer for non-static data member is a C++11 extension}}
#endif
};
const int kBlah = 3;
#if __cplusplus <= 199711L
- // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}}
+ // expected-warning@-2 {{default member initializer for non-static data member is a C++11 extension}}
#endif
Foo();
int i = 0;
#if __cplusplus <= 199711L
- // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}}
+ // expected-warning@-2 {{default member initializer for non-static data member is a C++11 extension}}
#endif
static int si = 0; // expected-error {{non-const static data member must be initialized out of line}}
static const NestedC ci = 0; // expected-error {{static data member of type 'const C::NestedC' must be initialized out of line}}
}
struct InClassInit {
- int n = 0; // expected-warning {{in-class initialization of non-static data members is incompatible with C++98}}
+ int n = 0; // expected-warning {{default member initializer for non-static data members is incompatible with C++98}}
};
struct OverrideControlBase {
};
struct UnknownBound {
- int as[] = { 1, 2, 3 }; // expected-error {{array bound cannot be deduced from an in-class initializer}}
+ int as[] = { 1, 2, 3 }; // expected-error {{array bound cannot be deduced from a default member initializer}}
int bs[4] = { 4, 5, 6, 7 };
- int cs[] = { 8, 9, 10 }; // expected-error {{array bound cannot be deduced from an in-class initializer}}
+ int cs[] = { 8, 9, 10 }; // expected-error {{array bound cannot be deduced from a default member initializer}}
};
template<int n> struct T { static const int B; };
template<> struct T<2> { template<int C, int D> using B = int; };
const int C = 0, D = 0;
struct S {
- int as[] = { decltype(x)::B<C, D>(0) }; // expected-error {{array bound cannot be deduced from an in-class initializer}}
+ int as[] = { decltype(x)::B<C, D>(0) }; // expected-error {{array bound cannot be deduced from a default member initializer}}
T<sizeof(as) / sizeof(int)> x;
// test that we handle invalid array bound deductions without crashing when the declarator name is itself invalid
operator int[](){}; // expected-error {{'operator int' cannot be the name of a variable or data member}} \
- // expected-error {{array bound cannot be deduced from an in-class initializer}}
+ // expected-error {{array bound cannot be deduced from a default member initializer}}
};
struct ThrowCtor { ThrowCtor(int) noexcept(false); };