Index: clang/include/clang/Basic/DiagnosticParseKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticParseKinds.td +++ clang/include/clang/Basic/DiagnosticParseKinds.td @@ -709,7 +709,7 @@ 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">, @@ -859,13 +859,13 @@ "%select{defaulted|deleted}0 function definitions are incompatible with C++98">, InGroup, 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; + "default member initializer for non-static data member is a C++11 " + "extension">, InGroup; def warn_cxx98_compat_nonstatic_member_init : Warning< - "in-class initialization of non-static data members is incompatible with C++98">, - InGroup, DefaultIgnore; + "default member initializer for non-static data members is incompatible with " + "C++98">, InGroup, DefaultIgnore; def ext_bitfield_member_init: ExtWarn< "default member initializer for bit-field is a C++20 extension">, InGroup; @@ -873,7 +873,7 @@ "default member initializer for bit-field is incompatible with " "C++ standards before C++20">, InGroup, 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< Index: clang/include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticSemaKinds.td +++ clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -1842,7 +1842,7 @@ 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">; @@ -8521,12 +8521,12 @@ "'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< Index: clang/lib/Sema/SemaDeclCXX.cpp =================================================================== --- clang/lib/Sema/SemaDeclCXX.cpp +++ clang/lib/Sema/SemaDeclCXX.cpp @@ -9403,7 +9403,8 @@ // 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; } @@ -15080,9 +15081,10 @@ // 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(); Index: clang/lib/Sema/SemaTemplateInstantiate.cpp =================================================================== --- clang/lib/Sema/SemaTemplateInstantiate.cpp +++ clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -2972,9 +2972,10 @@ 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; } @@ -2984,7 +2985,7 @@ 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; } Index: clang/test/Parser/MicrosoftExtensions.cpp =================================================================== --- clang/test/Parser/MicrosoftExtensions.cpp +++ clang/test/Parser/MicrosoftExtensions.cpp @@ -349,7 +349,7 @@ __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) {} Index: clang/test/Parser/cxx-class.cpp =================================================================== --- clang/test/Parser/cxx-class.cpp +++ clang/test/Parser/cxx-class.cpp @@ -229,34 +229,34 @@ 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 }; Index: clang/test/SemaCXX/PR9572.cpp =================================================================== --- clang/test/SemaCXX/PR9572.cpp +++ clang/test/SemaCXX/PR9572.cpp @@ -21,7 +21,7 @@ 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(); Index: clang/test/SemaCXX/class.cpp =================================================================== --- clang/test/SemaCXX/class.cpp +++ clang/test/SemaCXX/class.cpp @@ -44,7 +44,7 @@ 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}} @@ -188,7 +188,7 @@ struct A { #if __cplusplus <= 199711L static const float x = 5.0f; // expected-warning {{in-class initializer for static data member of type 'const float' is a GNU extension}} - static const float y = foo(); // expected-warning {{in-class initializer for static data member of type 'const float' is a GNU extension}} expected-error {{in-class initializer for static data member is not a constant expression}} + static const float y = foo(); // expected-warning {{in-class initializer for static data member of type 'const float' is a GNU extension}} expected-error {{default member initializer for static data member is not a constant expression}} #else static constexpr float x = 5.0f; static constexpr float y = foo(); // expected-error {{constexpr variable 'y' must be initialized by a constant expression}} expected-note {{non-constexpr function 'foo' cannot be used in a constant expression}} Index: clang/test/SemaCXX/cxx98-compat.cpp =================================================================== --- clang/test/SemaCXX/cxx98-compat.cpp +++ clang/test/SemaCXX/cxx98-compat.cpp @@ -122,7 +122,7 @@ } 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 { Index: clang/test/SemaCXX/member-init.cpp =================================================================== --- clang/test/SemaCXX/member-init.cpp +++ clang/test/SemaCXX/member-init.cpp @@ -21,20 +21,20 @@ }; 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 struct T { static const int B; }; template<> struct T<2> { template using B = int; }; const int C = 0, D = 0; struct S { - int as[] = { decltype(x)::B(0) }; // expected-error {{array bound cannot be deduced from an in-class initializer}} + int as[] = { decltype(x)::B(0) }; // expected-error {{array bound cannot be deduced from a default member initializer}} T 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); };