================ @@ -1472,3 +1472,144 @@ template<typename T> struct Outer { }; }; Outer<int>::Inner outerinner; + +struct Polymorphic { virtual ~Polymorphic() { } }; + +template<class... Bases> +struct Inherit : Bases... { // #TYPE_INHERIT + int g1; // #FIELD_G1 +}; + +template<class... Bases> +struct InheritWithExplicit : Bases... { // #TYPE_INHERIT_WITH_EXPLICIT + int g2 [[clang::requires_explicit_initialization]]; // #FIELD_G2 +}; + +struct Special {}; + +template<> +struct Inherit<Special> { + int g3 [[clang::requires_explicit_initialization]]; // #FIELD_G3 +}; + +template<> +struct InheritWithExplicit<Special> { + int g4; // #FIELD_G4 +}; + +void aggregate() { + struct NonAgg { + NonAgg() { } + [[clang::requires_explicit_initialization]] int na; // expected-warning {{'requires_explicit_initialization' attribute is ignored in non-aggregate type 'NonAgg'}} + }; + NonAgg nonagg; // no-warning + (void)nonagg; + + struct S { + [[clang::requires_explicit_initialization]] int s1; // #FIELD_S1 + int s2; + int s3 = 12; + [[clang::requires_explicit_initialization]] int s4 = 100; // #FIELD_S4 + static void foo(S) { } + }; + + struct C { + [[clang::requires_explicit_initialization]] int c1; // #FIELD_C1 +#if 201703L <= __cplusplus && __cplusplus < 202002L ---------------- higher-performance wrote:
Yup done. https://github.com/llvm/llvm-project/pull/102040 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits