brintos

brintos / llvm-project-archived public Read only

0
0
Text · 46.0 KiB · 2274041 Raw
1055 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-vla-cxx-extension -Wno-c++26-extensions -std=c++20 %s2 3struct S : A {}; // expected-error{{expected class name}}4 5static_assert(__builtin_is_cpp_trivially_relocatable()); // expected-error {{expected a type}}6static_assert(__builtin_is_cpp_trivially_relocatable(0)); // expected-error {{expected a type}}7static_assert(__builtin_is_cpp_trivially_relocatable(S));8static_assert(__builtin_is_cpp_trivially_relocatable(A)); // expected-error{{unknown type name 'A'}}9 10static_assert(__builtin_is_cpp_trivially_relocatable(int, int)); // expected-error {{type trait requires 1 argument; have 2 arguments}}11 12static_assert(__builtin_is_cpp_trivially_relocatable(int&));13// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_cpp_trivially_relocatable(int &)'}} \14// expected-note@-1 {{'int &' is not trivially relocatable}} \15// expected-note@-1 {{because it is a reference type}}16 17 18static_assert(!__builtin_is_cpp_trivially_relocatable(int&));19static_assert(!!__builtin_is_cpp_trivially_relocatable(int&));20// expected-error@-1{{static assertion failed due to requirement '!!__builtin_is_cpp_trivially_relocatable(int &)'}}21static_assert(bool(__builtin_is_cpp_trivially_relocatable(int&)));22// expected-error@-1{{static assertion failed due to requirement 'bool(__builtin_is_cpp_trivially_relocatable(int &))'}}23 24static_assert(__builtin_is_cpp_trivially_relocatable(int&) && __builtin_is_cpp_trivially_relocatable(int&));25// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_cpp_trivially_relocatable(int &)'}} \26// expected-note@-1 {{'int &' is not trivially relocatable}} \27// expected-note@-1 {{because it is a reference type}}28 29namespace concepts {30template <typename T>31requires __builtin_is_cpp_trivially_relocatable(T) void f();  // #cand132 33template <typename T>34concept C = __builtin_is_cpp_trivially_relocatable(T); // #concept235 36template <C T> void g();  // #cand237 38void test() {39    f<int&>();40    // expected-error@-1 {{no matching function for call to 'f'}} \41    // expected-note@#cand1 {{candidate template ignored: constraints not satisfied [with T = int &]}} \42    // expected-note@#cand1 {{because '__builtin_is_cpp_trivially_relocatable(int &)' evaluated to false}} \43    // expected-note@#cand1 {{'int &' is not trivially relocatable}} \44    // expected-note@#cand1 {{because it is a reference type}}45 46    g<int&>();47    // expected-error@-1 {{no matching function for call to 'g'}} \48    // expected-note@#cand2 {{candidate template ignored: constraints not satisfied [with T = int &]}} \49    // expected-note@#cand2 {{because 'int &' does not satisfy 'C'}} \50    // expected-note@#concept2 {{because '__builtin_is_cpp_trivially_relocatable(int &)' evaluated to false}} \51    // expected-note@#concept2 {{'int &' is not trivially relocatable}} \52    // expected-note@#concept2 {{because it is a reference type}}53}54}55 56namespace trivially_relocatable {57 58extern int vla_size;59static_assert(__builtin_is_cpp_trivially_relocatable(int[vla_size]));60// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_cpp_trivially_relocatable(int[vla_size])'}} \61// expected-note@-1 {{'int[vla_size]' is not trivially relocatable}} \62// expected-note@-1 {{because it is a variably-modified type}}63 64struct S; // expected-note {{forward declaration of 'trivially_relocatable::S'}}65static_assert(__builtin_is_cpp_trivially_relocatable(S));66// expected-error@-1 {{incomplete type 'S' used in type trait expression}}67 68struct B {69 virtual ~B();70};71struct S : virtual B { // #tr-S72    S();73    int & a;74    const int ci;75    B & b;76    B c;77    ~S();78};79static_assert(__builtin_is_cpp_trivially_relocatable(S));80// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_cpp_trivially_relocatable(trivially_relocatable::S)'}} \81// expected-note@-1 {{'S' is not trivially relocatable}} \82// expected-note@-1 {{because it has a virtual base 'B'}} \83// expected-note@-1 {{because it has a non-trivially-relocatable base 'B'}} \84// expected-note@-1 {{because it has a non-trivially-relocatable member 'c' of type 'B'}} \85// expected-note@-1 {{because it has a user-provided destructor}}86// expected-note@#tr-S {{'S' defined here}}87 88struct S2 { // #tr-S289    S2(S2&&);90    S2& operator=(const S2&);91};92static_assert(__builtin_is_cpp_trivially_relocatable(S2));93// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_cpp_trivially_relocatable(trivially_relocatable::S2)'}} \94// expected-note@-1 {{'S2' is not trivially relocatable}} \95// expected-note@-1 {{because it has a user provided move constructor}} \96// expected-note@-1 {{because it has a user provided copy assignment operator}} \97// expected-note@#tr-S2 {{'S2' defined here}}98 99 100struct S3 { // #tr-S3101    ~S3() = delete;102};103static_assert(__builtin_is_cpp_trivially_relocatable(S3));104// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_cpp_trivially_relocatable(trivially_relocatable::S3)'}} \105// expected-note@-1 {{'S3' is not trivially relocatable}} \106// expected-note@-1 {{because it has a deleted destructor}} \107// expected-note@#tr-S3 {{'S3' defined here}}108 109 110union U { // #tr-U111    U(const U&);112    U(U&&);113    U& operator=(const U&);114    U& operator=(U&&);115};116static_assert(__builtin_is_cpp_trivially_relocatable(U));117// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_cpp_trivially_relocatable(trivially_relocatable::U)'}} \118// expected-note@-1 {{'U' is not trivially relocatable}} \119// expected-note@-1 {{because it is a union with a user-declared copy constructor}} \120// expected-note@-1 {{because it is a union with a user-declared copy assignment operator}} \121// expected-note@-1 {{because it is a union with a user-declared move constructor}} \122// expected-note@-1 {{because it is a union with a user-declared move assignment operator}}123// expected-note@#tr-U {{'U' defined here}}124struct S4 trivially_relocatable_if_eligible { // #tr-S4125    ~S4();126    B b;127};128static_assert(__builtin_is_cpp_trivially_relocatable(S4));129// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_cpp_trivially_relocatable(trivially_relocatable::S4)'}} \130// expected-note@-1 {{'S4' is not trivially relocatable}} \131// expected-note@-1 {{because it has a non-trivially-relocatable member 'b' of type 'B'}} \132// expected-note@#tr-S4 {{'S4' defined here}}133 134union U2 trivially_relocatable_if_eligible { // #tr-U2135    U2(const U2&);136    U2(U2&&);137    B b;138};139static_assert(__builtin_is_cpp_trivially_relocatable(U2));140// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_cpp_trivially_relocatable(trivially_relocatable::U2)'}} \141// expected-note@-1 {{'U2' is not trivially relocatable}} \142// expected-note@-1 {{because it has a deleted destructor}} \143// expected-note@-1 {{because it has a non-trivially-relocatable member 'b' of type 'B'}} \144// expected-note@#tr-U2 {{'U2' defined here}}145}146 147namespace replaceable {148 149extern int vla_size;150static_assert(__builtin_is_replaceable(int[vla_size]));151// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_replaceable(int[vla_size])'}} \152// expected-note@-1 {{'int[vla_size]' is not replaceable}} \153// expected-note@-1 {{because it is a variably-modified type}}154 155struct S; // expected-note {{forward declaration of 'replaceable::S'}}156static_assert(__builtin_is_replaceable(S));157// expected-error@-1 {{incomplete type 'S' used in type trait expression}}158 159static_assert(__builtin_is_replaceable(const volatile int));160// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_replaceable(const volatile int)}} \161// expected-note@-1 {{'const volatile int' is not replaceable}} \162// expected-note@-1 {{because it is const}} \163// expected-note@-1 {{because it is volatile}}164 165 166static_assert(__builtin_is_replaceable(void()));167// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_replaceable(void ())}} \168// expected-note@-1 {{'void ()' is not replaceable}} \169// expected-note@-1 {{because it is not a scalar or class type}}170 171struct B {172 virtual ~B();173};174struct S : virtual B { // #replaceable-S175    S();176    int & a;177    const int ci;178    B & b;179    B c;180    ~S();181};182static_assert(__builtin_is_replaceable(S));183// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_replaceable(replaceable::S)'}} \184// expected-note@-1 {{'S' is not replaceable}} \185// expected-note@-1 {{because it has a non-replaceable base 'B'}} \186// expected-note@-1 {{because it has a non-replaceable member 'a' of type 'int &'}} \187// expected-note@-1 {{because it has a non-replaceable member 'ci' of type 'const int'}} \188// expected-note@-1 {{because it has a non-replaceable member 'b' of type 'B &'}} \189// expected-note@-1 {{because it has a non-replaceable member 'c' of type 'B'}} \190// expected-note@-1 {{because it has a user-provided destructor}} \191// expected-note@-1 {{because it has a deleted copy assignment operator}}192// expected-note@#replaceable-S {{'S' defined here}}193 194struct S2 { // #replaceable-S2195    S2(S2&&);196    S2& operator=(const S2&);197};198static_assert(__builtin_is_replaceable(S2));199// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_replaceable(replaceable::S2)'}} \200// expected-note@-1 {{'S2' is not replaceable}} \201// expected-note@-1 {{because it has a user provided move constructor}} \202// expected-note@-1 {{because it has a user provided copy assignment operator}} \203// expected-note@#replaceable-S2 {{'S2' defined here}}204 205 206struct S3 { // #replaceable-S3207    ~S3() = delete;208};209static_assert(__builtin_is_replaceable(S3));210// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_replaceable(replaceable::S3)'}} \211// expected-note@-1 {{'S3' is not replaceable}} \212// expected-note@-1 {{because it has a deleted destructor}} \213// expected-note@#replaceable-S3 {{'S3' defined here}}214 215 216union U { // #replaceable-U217    U(const U&);218    U(U&&);219    U& operator=(const U&);220    U& operator=(U&&);221};222static_assert(__builtin_is_replaceable(U));223// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_replaceable(replaceable::U)'}} \224// expected-note@-1 {{'U' is not replaceable}} \225// expected-note@-1 {{because it is a union with a user-declared copy constructor}} \226// expected-note@-1 {{because it is a union with a user-declared copy assignment operator}} \227// expected-note@-1 {{because it is a union with a user-declared move constructor}} \228// expected-note@-1 {{because it is a union with a user-declared move assignment operator}}229// expected-note@#replaceable-U {{'U' defined here}}230struct S4 replaceable_if_eligible { // #replaceable-S4231    ~S4();232    B b;233};234static_assert(__builtin_is_replaceable(S4));235// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_replaceable(replaceable::S4)'}} \236// expected-note@-1 {{'S4' is not replaceable}} \237// expected-note@-1 {{because it has a non-replaceable member 'b' of type 'B'}} \238// expected-note@#replaceable-S4 {{'S4' defined here}}239 240union U2 replaceable_if_eligible { // #replaceable-U2241    U2(const U2&);242    U2(U2&&);243    B b;244};245static_assert(__builtin_is_replaceable(U2));246// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_replaceable(replaceable::U2)'}} \247// expected-note@-1 {{'U2' is not replaceable}} \248// expected-note@-1 {{because it has a deleted destructor}} \249// expected-note@-1 {{because it has a non-replaceable member 'b' of type 'B'}} \250// expected-note@-1 {{because it has a deleted copy assignment operator}} \251// expected-note@#replaceable-U2 {{'U2' defined here}}252 253struct UD1 {  // #replaceable-UD1254    UD1(const UD1&) = delete;255    UD1 & operator=(const UD1&) = delete;256 257};258static_assert(__builtin_is_replaceable(UD1));259// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_replaceable(replaceable::UD1)'}} \260// expected-note@-1 {{'UD1' is not replaceable}} \261// expected-note@-1 {{because it has a deleted copy constructor}} \262// expected-note@-1 {{because it has a deleted copy assignment operator}} \263// expected-note@#replaceable-UD1 {{'UD1' defined here}}264 265 266struct UD2 {  // #replaceable-UD2267    UD2(UD2&&) = delete;268    UD2 & operator=(UD2&&) = delete;269};270static_assert(__builtin_is_replaceable(UD2));271// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_replaceable(replaceable::UD2)'}} \272// expected-note@-1 {{'UD2' is not replaceable}} \273// expected-note@-1 {{because it has a deleted move constructor}} \274// expected-note@-1 {{because it has a deleted move assignment operator}} \275// expected-note@#replaceable-UD2 {{'UD2' defined here}}276 277}278 279 280namespace GH143325 {281struct Foo  { // expected-note {{previous definition is here}}282  Foo(const Foo&);283  ~Foo();284};285 286struct Foo { // expected-error {{redefinition of 'Foo'}}287  Foo();288  int;289};290struct Wrapper { // #GH143325-Wrapper291  union {292    Foo p;293  } u;294};295 296static_assert(__builtin_is_cpp_trivially_relocatable(Wrapper));297// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_cpp_trivially_relocatable(GH143325::Wrapper)'}} \298// expected-note@-1 {{'Wrapper' is not trivially relocatable}} \299// expected-note@-1 {{because it has a non-trivially-relocatable member 'u' of type 'union}} \300// expected-note@-1 {{because it has a deleted destructor}}301// expected-note@#GH143325-Wrapper {{'Wrapper' defined here}}302 303struct Polymorphic  {304  virtual ~Polymorphic();305};306 307struct UnionOfPolymorphic { // #GH143325-UnionOfPolymorphic308  union {309    Polymorphic p;310    int i;311  } u;312};313 314static_assert(__builtin_is_cpp_trivially_relocatable(UnionOfPolymorphic));315// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_cpp_trivially_relocatable(GH143325::UnionOfPolymorphic)'}} \316// expected-note@-1 {{'UnionOfPolymorphic' is not trivially relocatable}} \317// expected-note@-1 {{because it has a non-trivially-relocatable member 'u' of type 'union}} \318// expected-note@-1 {{because it has a deleted destructor}} \319// expected-note@#GH143325-UnionOfPolymorphic {{'UnionOfPolymorphic' defined here}}320 321}322 323struct GH143599 {  // expected-note 2 {{'GH143599' defined here}}324    ~GH143599 ();325     GH143599(const GH143599&);326     GH143599& operator=(const GH143599&);327};328GH143599::~GH143599 () = default;329GH143599::GH143599 (const GH143599&) = default;330GH143599& GH143599::operator=(const GH143599&) = default;331 332static_assert (__builtin_is_cpp_trivially_relocatable(GH143599));333// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_cpp_trivially_relocatable(GH143599)'}} \334// expected-note@-1 {{'GH143599' is not trivially relocatable}} \335// expected-note@-1 {{because it has a user provided copy constructor}} \336// expected-note@-1 {{because it has a user provided copy assignment operator}} \337// expected-note@-1 {{because it has a user-provided destructor}}338 339static_assert (__builtin_is_replaceable(GH143599));340// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_replaceable(GH143599)'}} \341// expected-note@-1 {{'GH143599' is not replaceable}} \342// expected-note@-1 {{because it has a user provided copy constructor}} \343// expected-note@-1 {{because it has a user provided copy assignment operator}} \344// expected-note@-1 {{because it has a user-provided destructor}}345 346namespace trivially_copyable {347struct B {348 virtual ~B();349};350struct S : virtual B { // #tc-S351    S();352    int & a;353    const int ci;354    B & b;355    B c;356    ~S();357};358static_assert(__is_trivially_copyable(S));359// expected-error@-1 {{static assertion failed due to requirement '__is_trivially_copyable(trivially_copyable::S)'}} \360// expected-note@-1 {{'S' is not trivially copyable}} \361// expected-note@-1 {{because it has a virtual base 'B'}} \362// expected-note@-1 {{because it has a non-trivially-copyable base 'B'}} \363// expected-note@-1 {{because it has a non-trivially-copyable member 'c' of type 'B'}} \364// expected-note@-1 {{because it has a non-trivially-copyable member 'b' of type 'B &'}} \365// expected-note@-1 {{because it has a non-trivially-copyable member 'a' of type 'int &'}} \366// expected-note@-1 {{because it has a user-provided destructor}}367// expected-note@#tc-S {{'S' defined here}}368 369struct S2 { // #tc-S2370    S2(S2&&);371    S2& operator=(const S2&);372};373static_assert(__is_trivially_copyable(S2));374// expected-error@-1 {{static assertion failed due to requirement '__is_trivially_copyable(trivially_copyable::S2)'}} \375// expected-note@-1 {{'S2' is not trivially copyable}} \376// expected-note@-1 {{because it has a user provided move constructor}} \377// expected-note@-1 {{because it has a user provided copy assignment operator}} \378// expected-note@#tc-S2 {{'S2' defined here}}379 380struct S3 {381    ~S3() = delete;382};383static_assert(__is_trivially_copyable(S3));384 385struct S4 { // #tc-S4386    ~S4();387    B b;388};389static_assert(__is_trivially_copyable(S4));390// expected-error@-1 {{static assertion failed due to requirement '__is_trivially_copyable(trivially_copyable::S4)'}} \391// expected-note@-1 {{'S4' is not trivially copyable}} \392// expected-note@-1 {{because it has a non-trivially-copyable member 'b' of type 'B'}} \393// expected-note@-1 {{because it has a user-provided destructor}} \394// expected-note@#tc-S4 {{'S4' defined here}}395 396struct B1 {397    int & a;398};399 400struct B2 {401    int & a;402};403 404struct S5 : virtual B1, virtual B2 { // #tc-S5405};406static_assert(__is_trivially_copyable(S5));407// expected-error@-1 {{static assertion failed due to requirement '__is_trivially_copyable(trivially_copyable::S5)'}} \408// expected-note@-1 {{'S5' is not trivially copyable}} \409// expected-note@-1 {{because it has a virtual base 'B1'}} \410// expected-note@-1 {{because it has a virtual base 'B2'}} \411// expected-note@#tc-S5 {{'S5' defined here}}412 413struct B3 {414    ~B3();415};416 417struct B4 {418    ~B4();419};420 421struct S6 : B3, B4 { // #tc-S6422};423static_assert(__is_trivially_copyable(S6));424// expected-error@-1 {{static assertion failed due to requirement '__is_trivially_copyable(trivially_copyable::S6)'}} \425// expected-note@-1 {{because it has a non-trivially-copyable base 'B3'}} \426// expected-note@-1 {{because it has a non-trivially-copyable base 'B4'}} \427// expected-note@-1 {{because it has a user-provided destructor}} \428// expected-note@-1 {{'S6' is not trivially copyable}} \429// expected-note@#tc-S6 {{'S6' defined here}}430 431struct S7 { // #tc-S7432    S7(const S7&);433};434static_assert(__is_trivially_copyable(S7));435// expected-error@-1 {{static assertion failed due to requirement '__is_trivially_copyable(trivially_copyable::S7)'}} \436// expected-note@-1 {{because it has a user provided copy constructor}} \437// expected-note@-1 {{'S7' is not trivially copyable}} \438// expected-note@#tc-S7 {{'S7' defined here}}439 440struct S8 { // #tc-S8441    S8(S8&&);442};443static_assert(__is_trivially_copyable(S8));444// expected-error@-1 {{static assertion failed due to requirement '__is_trivially_copyable(trivially_copyable::S8)'}} \445// expected-note@-1 {{because it has a user provided move constructor}} \446// expected-note@-1 {{'S8' is not trivially copyable}} \447// expected-note@#tc-S8 {{'S8' defined here}}448 449struct S9 { // #tc-S9450    S9& operator=(const S9&);451};452static_assert(__is_trivially_copyable(S9));453// expected-error@-1 {{static assertion failed due to requirement '__is_trivially_copyable(trivially_copyable::S9)'}} \454// expected-note@-1 {{because it has a user provided copy assignment operator}} \455// expected-note@-1 {{'S9' is not trivially copyable}} \456// expected-note@#tc-S9 {{'S9' defined here}}457 458struct S10 { // #tc-S10459    S10& operator=(S10&&);460};461static_assert(__is_trivially_copyable(S10));462// expected-error@-1 {{static assertion failed due to requirement '__is_trivially_copyable(trivially_copyable::S10)'}} \463// expected-note@-1 {{because it has a user provided move assignment operator}} \464// expected-note@-1 {{'S10' is not trivially copyable}} \465// expected-note@#tc-S10 {{'S10' defined here}}466 467struct B5 : B4 {468};469 470struct B6 : B5  {471};472 473struct S11 : B6 { // #tc-S11474};475static_assert(__is_trivially_copyable(S11));476// expected-error@-1 {{static assertion failed due to requirement '__is_trivially_copyable(trivially_copyable::S11)'}} \477// expected-note@-1 {{because it has a non-trivially-copyable base 'B6'}} \478// expected-note@-1 {{'S11' is not trivially copyable}} \479// expected-note@#tc-S11 {{'S11' defined here}}480 481struct S12 : B6 { // #tc-S12482    ~S12() = delete;483};484static_assert(__is_trivially_copyable(S12));485// expected-error@-1 {{static assertion failed due to requirement '__is_trivially_copyable(trivially_copyable::S12)'}} \486// expected-note@-1 {{because it has a non-trivially-copyable base 'B6'}} \487// expected-note@-1 {{because it has a deleted destructor}} \488// expected-note@-1 {{'S12' is not trivially copyable}} \489// expected-note@#tc-S12 {{'S12' defined here}}490}491 492namespace constructible {493 494struct S1 {  // #c-S1495    S1(int); // #cc-S1496};497static_assert(__is_constructible(S1, char*));498// expected-error@-1 {{static assertion failed due to requirement '__is_constructible(constructible::S1, char *)'}} \499// expected-error@-1 {{no matching constructor for initialization of 'S1'}} \500// expected-note@#c-S1 {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'char *' to 'const S1' for 1st argument}} \501// expected-note@#c-S1 {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'char *' to 'S1' for 1st argument}} \502// expected-note@#cc-S1 {{candidate constructor not viable: no known conversion from 'char *' to 'int' for 1st argument; dereference the argument with *}} \503// expected-note@#c-S1 {{'S1' defined here}}504 505struct S2 { // #c-S2506    S2(int, float, double); // #cc-S2507};508static_assert(__is_constructible(S2, float));509// expected-error@-1 {{static assertion failed due to requirement '__is_constructible(constructible::S2, float)'}} \510// expected-note@#c-S2 {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'float' to 'const S2' for 1st argument}} \511// expected-note@#c-S2 {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'float' to 'S2' for 1st argument}} \512// expected-error@-1 {{no matching constructor for initialization of 'S2'}} \513// expected-note@#cc-S2 {{candidate constructor not viable: requires 3 arguments, but 1 was provided}} \514// expected-note@#c-S2 {{'S2' defined here}}515 516static_assert(__is_constructible(S2, float, void));517// expected-error@-1 {{static assertion failed due to requirement '__is_constructible(constructible::S2, float, void)'}} \518// expected-note@#c-S2 {{candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 2 were provided}} \519// expected-note@#c-S2 {{candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided}} \520// expected-note@-1{{because it is a cv void type}} \521// expected-error@-1 {{no matching constructor for initialization of 'S2'}} \522// expected-note@#cc-S2 {{candidate constructor not viable: requires 3 arguments, but 2 were provided}} \523// expected-note@#c-S2 {{'S2' defined here}}524 525static_assert(__is_constructible(int[]));526// expected-error@-1 {{static assertion failed due to requirement '__is_constructible(int[])'}} \527// expected-note@-1 {{because it is an incomplete array type}}528 529static_assert(__is_constructible(void));530// expected-error@-1 {{static assertion failed due to requirement '__is_constructible(void)'}} \531// expected-note@-1 {{because it is a cv void type}}532 533static_assert(__is_constructible(void, void));534// expected-error@-1 {{static assertion failed due to requirement '__is_constructible(void, void)'}} \535// expected-note@-1 {{because it is a cv void type}}536 537static_assert(__is_constructible(const void));538// expected-error@-1 {{static assertion failed due to requirement '__is_constructible(const void)'}} \539// expected-note@-1 {{because it is a cv void type}}540 541static_assert(__is_constructible(volatile void));542// expected-error@-1 {{static assertion failed due to requirement '__is_constructible(volatile void)'}} \543// expected-note@-1 {{because it is a cv void type}}544 545static_assert(__is_constructible(int ()));546// expected-error@-1 {{static assertion failed due to requirement '__is_constructible(int ())'}} \547// expected-note@-1 {{because it is a function type}}548 549static_assert(__is_constructible(void (int, float)));550// expected-error@-1 {{static assertion failed due to requirement '__is_constructible(void (int, float))'}} \551// expected-note@-1 {{because it is a function type}}552}553 554namespace assignable {555struct S1;556static_assert(__is_assignable(S1&, const S1&));557// expected-error@-1 {{static assertion failed due to requirement '__is_assignable(assignable::S1 &, const assignable::S1 &)'}} \558// expected-error@-1 {{no viable overloaded '='}} \559// expected-note@-1 {{type 'S1' is incomplete}}560 561static_assert(__is_assignable(void, int));562// expected-error@-1 {{static assertion failed due to requirement '__is_assignable(void, int)'}} \563// expected-error@-1 {{expression is not assignable}}564 565static_assert(__is_assignable(int, int));566// expected-error@-1 {{static assertion failed due to requirement '__is_assignable(int, int)'}} \567// expected-error@-1 {{expression is not assignable}}568 569static_assert(__is_assignable(int*, int));570// expected-error@-1 {{static assertion failed due to requirement '__is_assignable(int *, int)'}} \571// expected-error@-1 {{expression is not assignable}}572 573static_assert(__is_assignable(int[], int));574// expected-error@-1 {{static assertion failed due to requirement '__is_assignable(int[], int)'}} \575// expected-error@-1 {{expression is not assignable}}576 577static_assert(__is_assignable(int&, void));578// expected-error@-1 {{static assertion failed due to requirement '__is_assignable(int &, void)'}} \579// expected-error@-1 {{assigning to 'int' from incompatible type 'void'}}580 581static_assert(__is_assignable(int*&, float*));582// expected-error@-1 {{static assertion failed due to requirement '__is_assignable(int *&, float *)'}} \583// expected-error@-1 {{incompatible pointer types assigning to 'int *' from 'float *'}}584 585static_assert(__is_assignable(const int&, int));586// expected-error@-1 {{static assertion failed due to requirement '__is_assignable(const int &, int)'}} \587// expected-error@-1 {{read-only variable is not assignable}}588 589struct S2 {}; // #a-S2590static_assert(__is_assignable(const S2, S2));591// expected-error@-1 {{static assertion failed due to requirement '__is_assignable(const assignable::S2, assignable::S2)'}} \592// expected-error@-1 {{no viable overloaded '='}} \593// expected-note@#a-S2 {{candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const S2', but method is not marked const}} \594// expected-note@#a-S2 {{candidate function (the implicit move assignment operator) not viable: 'this' argument has type 'const S2', but method is not marked const}} \595// expected-note@#a-S2 {{'S2' defined here}}596 597struct S3 { // #a-S3598    S3& operator=(const S3&) = delete; // #aca-S3599    S3& operator=(S3&&) = delete;  // #ama-S3600};601static_assert(__is_assignable(S3, const S3&));602// expected-error@-1 {{static assertion failed due to requirement '__is_assignable(assignable::S3, const assignable::S3 &)'}} \603// expected-error@-1 {{overload resolution selected deleted operator '='}} \604// expected-note@#aca-S3 {{candidate function has been explicitly deleted}} \605// expected-note@#ama-S3 {{candidate function not viable: 1st argument ('const S3') would lose const qualifier}} \606// expected-note@#a-S3 {{'S3' defined here}}607static_assert(__is_assignable(S3, S3&&));608// expected-error@-1 {{static assertion failed due to requirement '__is_assignable(assignable::S3, assignable::S3 &&)'}} \609// expected-error@-1 {{overload resolution selected deleted operator '='}} \610// expected-note@#aca-S3 {{candidate function has been explicitly deleted}} \611// expected-note@#ama-S3 {{candidate function has been explicitly deleted}} \612// expected-note@#a-S3 {{'S3' defined here}}613 614class C1 { // #a-C1615    C1& operator=(const C1&) = default;616    C1& operator=(C1&&) = default; // #ama-C1617};618static_assert(__is_assignable(C1, C1));619// expected-error@-1 {{static assertion failed due to requirement '__is_assignable(assignable::C1, assignable::C1)'}} \620// expected-error@-1 {{'operator=' is a private member of 'assignable::C1'}} \621// expected-note@#ama-C1 {{implicitly declared private here}} \622// expected-note@#a-C1 {{'C1' defined here}}623}624 625namespace is_empty_tests {626    // Non-static data member.627    struct A { int x; }; // #e-A628    static_assert(__is_empty(A));629    // expected-error@-1 {{static assertion failed due to requirement '__is_empty(is_empty_tests::A)'}} \630    // expected-note@-1 {{'A' is not empty}} \631    // expected-note@-1 {{because it has a non-static data member 'x' of type 'int'}} \632    // expected-note@#e-A {{'A' defined here}}633 634    // Reference member.635    struct R {int &r; }; // #e-R636    static_assert(__is_empty(R));637    // expected-error@-1 {{static assertion failed due to requirement '__is_empty(is_empty_tests::R)'}} \638    // expected-note@-1 {{'R' is not empty}} \639    // expected-note@-1 {{because it has a non-static data member 'r' of type 'int &'}} \640    // expected-note@#e-R {{'R' defined here}}641 642    // Virtual function.643    struct VirtualFunc {virtual void f(); }; // #e-VirtualFunc644    static_assert(__is_empty(VirtualFunc));645    // expected-error@-1 {{static assertion failed due to requirement '__is_empty(is_empty_tests::VirtualFunc)'}} \646    // expected-note@-1 {{'VirtualFunc' is not empty}} \647    // expected-note@-1 {{because it has a virtual function 'f'}} \648    // expected-note@#e-VirtualFunc {{'VirtualFunc' defined here}}649 650    // Virtual base class.651    struct EB {};652    struct VB: virtual EB {}; // #e-VB653    static_assert(__is_empty(VB));654    // expected-error@-1 {{static assertion failed due to requirement '__is_empty(is_empty_tests::VB)'}} \655    // expected-note@-1 {{'VB' is not empty}} \656    // expected-note@-1 {{because it has a virtual base 'EB'}} \657    // expected-note@#e-VB {{'VB' defined here}}658 659    // Non-empty base class.660    struct Base { int b; }; // #e-Base661    struct Derived : Base {}; // #e-Derived662    static_assert(__is_empty(Derived));663    // expected-error@-1 {{static assertion failed due to requirement '__is_empty(is_empty_tests::Derived)'}} \664    // expected-note@-1 {{'Derived' is not empty}} \665    // expected-note@-1 {{because it has a base class 'Base' that is not empty}} \666    // expected-note@#e-Derived {{'Derived' defined here}} 667 668    // Combination of the above.669    struct Multi : Base, virtual EB { // #e-Multi670        int z;671        virtual void g();672    };673    static_assert(__is_empty(Multi));674    // expected-error@-1 {{static assertion failed due to requirement '__is_empty(is_empty_tests::Multi)'}} \675    // expected-note@-1 {{'Multi' is not empty}} \676    // expected-note@-1 {{because it has a non-static data member 'z' of type 'int'}} \677    // expected-note@-1 {{because it has a virtual function 'g'}} \678    // expected-note@-1 {{because it has a base class 'Base' that is not empty}} \679    // expected-note@-1 {{because it has a virtual base 'EB'}} \680    // expected-note@#e-Multi {{'Multi' defined here}}681 682    // Zero-width bit-field.683    struct BitField { int : 0; }; // #e-BitField684    static_assert(__is_empty(BitField)); // no diagnostics  685 686    // Dependent bit-field width. 687    template <int N>688    struct DependentBitField { int : N; }; // #e-DependentBitField689 690    static_assert(__is_empty(DependentBitField<0>)); // no diagnostics691 692    static_assert(__is_empty(DependentBitField<2>)); 693    // expected-error@-1 {{static assertion failed due to requirement '__is_empty(is_empty_tests::DependentBitField<2>)'}} \694    // expected-note@-1 {{'DependentBitField<2>' is not empty}} \695    // expected-note@-1 {{because it field '' is a non-zero-length bit-field}} \696    // expected-note@#e-DependentBitField {{'DependentBitField<2>' defined here}}697 698}699 700namespace standard_layout_tests {701struct WithVirtual { // #sl-Virtual702    virtual void foo(); // #sl-Virtual-Foo703};704static_assert(__is_standard_layout(WithVirtual));705// expected-error@-1 {{static assertion failed due to requirement '__is_standard_layout(standard_layout_tests::WithVirtual)'}} \706// expected-note@-1 {{'WithVirtual' is not standard-layout}} \707// expected-note@-1 {{because it has a virtual function 'foo'}} \708// expected-note@#sl-Virtual-Foo {{'foo' defined here}} \709// expected-note@#sl-Virtual {{'WithVirtual' defined here}}710 711struct MixedAccess { // #sl-Mixed712public:713    int a; // #sl-MixedF1714private:715    int b; // #sl-MixedF2716};717static_assert(__is_standard_layout(MixedAccess));718// expected-error@-1 {{static assertion failed due to requirement '__is_standard_layout(standard_layout_tests::MixedAccess)'}} \719// expected-note@-1 {{'MixedAccess' is not standard-layout}} \720// expected-note@-1 {{because it has mixed access specifiers}} \721// expected-note@#sl-MixedF1 {{'a' defined here}}722// expected-note@#sl-MixedF2 {{field 'b' has a different access specifier than field 'a'}}723// expected-note@#sl-Mixed {{'MixedAccess' defined here}}724 725struct VirtualBase { virtual ~VirtualBase(); };               // #sl-VirtualBase726struct VB : virtual VirtualBase {};                            // #sl-VB727static_assert(__is_standard_layout(VB));728// expected-error@-1 {{static assertion failed due to requirement '__is_standard_layout(standard_layout_tests::VB)'}} \729// expected-note@-1 {{'VB' is not standard-layout}} \730// expected-note@-1 {{because it has a virtual base 'VirtualBase'}} \731// expected-note@-1 {{because it has a non-standard-layout base 'VirtualBase'}} \732// expected-note@-1 {{because it has a virtual function '~VB'}} \733// expected-note@#sl-VB {{'VB' defined here}}734// expected-note@#sl-VB {{'~VB' defined here}}735 736union U {      // #sl-U737public:738    int x; // #sl-UF1739private:740    int y; // #sl-UF2741};                                                       742static_assert(__is_standard_layout(U));743// expected-error@-1 {{static assertion failed due to requirement '__is_standard_layout(standard_layout_tests::U)'}} \744// expected-note@-1 {{'U' is not standard-layout}} \745// expected-note@-1 {{because it has mixed access specifiers}}746// expected-note@#sl-UF1 {{'x' defined here}}747// expected-note@#sl-UF2 {{field 'y' has a different access specifier than field 'x'}}748// expected-note@#sl-U {{'U' defined here}}749 750// Single base class is OK751struct BaseClass{ int a; };                                   // #sl-BaseClass752struct DerivedOK : BaseClass {};                                // #sl-DerivedOK753static_assert(__is_standard_layout(DerivedOK));    754 755// Primitive types should be standard layout756static_assert(__is_standard_layout(int));                     // #sl-Int757static_assert(__is_standard_layout(float));                   // #sl-Float758 759// Multi-level inheritance: Non-standard layout760struct Base1 { int a; };                                      // #sl-Base1761struct Base2 { int b; };                                      // #sl-Base2762struct DerivedClass : Base1, Base2 {};                        // #sl-DerivedClass763static_assert(__is_standard_layout(DerivedClass));               764// expected-error@-1 {{static assertion failed due to requirement '__is_standard_layout(standard_layout_tests::DerivedClass)'}} \765// expected-note@-1 {{'DerivedClass' is not standard-layout}} \766// expected-note@-1 {{because it has multiple base classes with data members}} \767// expected-note@#sl-DerivedClass {{'DerivedClass' defined here}} 768 769// Inheritance hierarchy with multiple classes having data members770struct BaseA { int a; };                                      // #sl-BaseA771struct BaseB : BaseA {};                                      // inherits BaseA, has no new members772struct BaseC: BaseB { int c; };                               // #sl-BaseC773static_assert(__is_standard_layout(BaseC));774// expected-error@-1 {{static assertion failed due to requirement '__is_standard_layout(standard_layout_tests::BaseC)'}} \775// expected-note@-1 {{'BaseC' is not standard-layout}} \776// expected-note@-1 {{because it has an indirect base 'BaseA' with data members}} \777// expected-note@#sl-BaseC {{'BaseC' defined here}} \778// Multiple direct base classes with no data members --> standard layout779struct BaseX {};                                              // #sl-BaseX780struct BaseY {};                                              // #sl-BaseY781struct MultiBase : BaseX, BaseY {};                          // #sl-MultiBase782static_assert(__is_standard_layout(MultiBase));783 784struct A {785  int x;786};787 788struct B : A {789};790// Indirect base with data members791struct C : B { int y; }; // #sl-C792static_assert(__is_standard_layout(C));793// expected-error@-1 {{static assertion failed due to requirement '__is_standard_layout(standard_layout_tests::C)'}} \794// expected-note@-1 {{'C' is not standard-layout}} \795// expected-note@-1 {{because it has an indirect base 'A' with data members}} \796// expected-note@#sl-C {{'C' defined here}}797 798struct D {799    union { int a; float b; };800  }; // #sl-D801static_assert(__is_standard_layout(D)); // no diagnostics802 803// E inherits D but adds a new member804struct E : D { int x; }; // #sl-E805static_assert(__is_standard_layout(E));806// expected-error@-1 {{static assertion failed due to requirement '__is_standard_layout(standard_layout_tests::E)'}} \807// expected-note@-1 {{'E' is not standard-layout}} \808// expected-note@-1 {{because it has an indirect base 'D' with data members}} \809// expected-note@#sl-E {{'E' defined here}}810 811// F inherits D but only an unnamed bitfield812// This should still fail because F ends up with a 813// base class with a data member and its own unnamed bitfield814// which is not allowed in standard layout815struct F : D { int : 0; }; // #sl-F816static_assert(__is_standard_layout(F));817// expected-error@-1 {{static assertion failed due to requirement '__is_standard_layout(standard_layout_tests::F)'}} \818// expected-note@-1 {{'F' is not standard-layout}} \819// expected-note@#sl-F {{'F' defined here}}820 821struct Empty {};822struct G { Empty a, b; }; // #sl-G823static_assert(__is_standard_layout(G)); // no diagnostics824 825struct H { Empty a; int x; }; // #sl-H826static_assert(__is_standard_layout(H)); // no diagnostics827 828 struct I { Empty a; int : 0; int x; }; // #sl-I829static_assert(__is_standard_layout(I)); // no diagnostics830}831 832namespace is_final_tests {833    struct C {}; // #e-C834    static_assert(__is_final(C));835    // expected-error@-1 {{static assertion failed due to requirement '__is_final(is_final_tests::C)'}} \836    // expected-note@-1 {{'C' is not final}} \837    // expected-note@-1 {{because it is not marked 'final'}} \838    // expected-note@#e-C {{'C' defined here}}839 840    union U {}; // #e-U841    static_assert(__is_final(U));842    // expected-error@-1 {{static assertion failed due to requirement '__is_final(is_final_tests::U)'}} \843    // expected-note@-1 {{'U' is not final}} \844    // expected-note@-1 {{because it is not marked 'final'}} \845    // expected-note@#e-U {{'U' defined here}}846 847    // ----- non-class/union types -----848    using I = int;849    static_assert(__is_final(I));850    // expected-error@-1 {{static assertion failed due to requirement '__is_final(int)'}} \851    // expected-note@-1 {{'I' (aka 'int') is not final}} \852    // expected-note@-1 {{because it is not a class or union type}}853 854    using Fty = void(); // function type855    static_assert(__is_final(Fty));856    // expected-error@-1 {{static assertion failed due to requirement '__is_final(void ())'}} \857    // expected-note@-1 {{'Fty' (aka 'void ()') is not final}} \858    // expected-note@-1 {{because it is a function type}} \859    // expected-note@-1 {{because it is not a class or union type}}860 861    using Arr = int[3];862    static_assert(__is_final(Arr));863    // expected-error@-1 {{static assertion failed due to requirement '__is_final(int[3])'}} \864    // expected-note@-1 {{'Arr' (aka 'int[3]') is not final}} \865    // expected-note@-1 {{because it is not a class or union type}}866 867    using Ref = int&;868    static_assert(__is_final(Ref));869    // expected-error@-1 {{static assertion failed due to requirement '__is_final(int &)'}} \870    // expected-note@-1 {{'Ref' (aka 'int &') is not final}} \871    // expected-note@-1 {{because it is a reference type}} \872    // expected-note@-1 {{because it is not a class or union type}}873 874}875namespace is_aggregate {876  struct S1 {  // #ag-S1877    S1(int);878  };879 880  static_assert(__is_aggregate(S1));881  // expected-error@-1 {{static assertion failed due to requirement '__is_aggregate(is_aggregate::S1)'}} \882  // expected-note@-1 {{because it has a user-declared constructor}} \883  // expected-note@-1 {{'S1' is not aggregate}} \884  // expected-note@#ag-S1 {{'S1' defined here}}885 886  struct B2 {887    B2(int);888  };889 890  struct S2 : B2 { // #ag-S2891    using B2::B2;892  };893 894  static_assert(__is_aggregate(S2));895  // expected-error@-1 {{static assertion failed due to requirement '__is_aggregate(is_aggregate::S2)'}} \896  // expected-note@-1 {{because it has an inherited constructor}} \897  // expected-note@-1 {{'S2' is not aggregate}} \898  // expected-note@#ag-S2 {{'S2' defined here}}899 900  struct S3 { // #ag-S3901    protected:902      int x;903  };904  static_assert(__is_aggregate(S3));905  // expected-error@-1 {{static assertion failed due to requirement '__is_aggregate(is_aggregate::S3)'}} \906  // expected-note@-1 {{because it has a protected direct data member}} \907  // expected-note@-1 {{'S3' is not aggregate}} \908  // expected-note@#ag-S3 {{'S3' defined here}}909 910  struct S4 { // #ag-S4911    private:912      int x;913  };914  static_assert(__is_aggregate(S4));915  // expected-error@-1 {{static assertion failed due to requirement '__is_aggregate(is_aggregate::S4)'}} \916  // expected-note@-1 {{because it has a private direct data member}} \917  // expected-note@-1 {{'S4' is not aggregate}} \918  // expected-note@#ag-S4 {{'S4' defined here}}919 920  struct B5 {};921 922  struct S5 : private B5 { // #ag-S5923    private:924      int x;925  };926  static_assert(__is_aggregate(S5));927  // expected-error@-1 {{static assertion failed due to requirement '__is_aggregate(is_aggregate::S5)'}} \928  // expected-note@-1 {{because it has a private direct base}} \929  // expected-note@-1 {{because it has a private direct data member}} \930  // expected-note@-1 {{'S5' is not aggregate}} \931  // expected-note@#ag-S5 {{'S5' defined here}}932 933  struct B6 {};934 935  struct S6 : protected B6 { // #ag-S6936    private:937      int x;938  };939  static_assert(__is_aggregate(S6));940  // expected-error@-1 {{static assertion failed due to requirement '__is_aggregate(is_aggregate::S6)'}} \941  // expected-note@-1 {{because it has a protected direct base}} \942  // expected-note@-1 {{because it has a private direct data member}} \943  // expected-note@-1 {{'S6' is not aggregate}} \944  // expected-note@#ag-S6 {{'S6' defined here}}945 946  static_assert(__is_aggregate(S6[]));947 948  struct B7 {};949 950  struct S7 : virtual B7 { // #ag-S7951    virtual void foo();952 953    private:954      int x;955  };956  static_assert(__is_aggregate(S7));957  // expected-error@-1 {{static assertion failed due to requirement '__is_aggregate(is_aggregate::S7)'}} \958  // expected-note@-1 {{because it has a private direct data member}} \959  // expected-note@-1 {{because it has a virtual function 'foo'}} \960  // expected-note@-1 {{because it has a virtual base}} \961  // expected-note@-1 {{'S7' is not aggregate}} \962  // expected-note@-1 {{because it is a polymorphic type}} \963  // expected-note@#ag-S7 {{'S7' defined here}}964 965  static_assert(__is_aggregate(S7[10]));966}967 968namespace is_abstract_tests {969struct Abstract1 {970  virtual void fn1() = 0;971};972 973struct Abstract2 {974   virtual void fn2() = 0;975};976 977struct NonAbstract978{979   virtual void f() {}980};981 982// Multiple inheritance reports all abstract base classes that had their pure virtual functions overridden.983struct Overrides : Abstract1, Abstract2, NonAbstract {984  void fn1() override {}985  void fn2() override {}986};987 988static_assert(__is_abstract(Overrides));989// expected-error@-1 {{static assertion failed due to requirement '__is_abstract(is_abstract_tests::Overrides)'}} \990// expected-note@-1 {{'Overrides' is not abstract}} \991// expected-note@-1 {{because it overrides all pure virtual functions from base class 'Abstract1'}} \992// expected-note@-1 {{because it overrides all pure virtual functions from base class 'Abstract2'}} \993 994static_assert(__is_abstract(NonAbstract));995// expected-error@-1 {{static assertion failed due to requirement '__is_abstract(is_abstract_tests::NonAbstract)'}} \996// expected-note@-1 {{'NonAbstract' is not abstract}}997 998// Inheriting over two levels reports the last class only although the source of the pure virtual function999// is the top-most base.1000struct Derived : Abstract1 {1001};1002 1003struct Derived2 : Derived {1004   void fn1() override {}1005};1006 1007static_assert(__is_abstract(Derived2));1008// expected-error@-1 {{static assertion failed due to requirement '__is_abstract(is_abstract_tests::Derived2)'}} \1009// expected-note@-1 {{'Derived2' is not abstract}} \1010// expected-note@-1 {{because it overrides all pure virtual functions from base class 'Derived'}} \1011 1012 1013using I = int;1014static_assert(__is_abstract(I));1015// expected-error@-1 {{static assertion failed due to requirement '__is_abstract(int)'}} \1016// expected-note@-1 {{'I' (aka 'int') is not abstract}} \1017// expected-note@-1 {{because it is not a struct or class type}}1018 1019using Fty = void();1020static_assert(__is_abstract(Fty));1021// expected-error@-1 {{static assertion failed due to requirement '__is_abstract(void ())'}} \1022// expected-note@-1 {{'Fty' (aka 'void ()') is not abstract}} \1023// expected-note@-1 {{because it is a function type}} \1024// expected-note@-1 {{because it is not a struct or class type}}1025 1026using Arr = int[3];1027static_assert(__is_abstract(Arr));1028// expected-error@-1 {{static assertion failed due to requirement '__is_abstract(int[3])'}} \1029// expected-note@-1 {{'Arr' (aka 'int[3]') is not abstract}} \1030// expected-note@-1 {{because it is an array type}} \1031// expected-note@-1 {{because it is not a struct or class type}}1032 1033using Ref = int&;1034static_assert(__is_abstract(Ref));1035// expected-error@-1 {{static assertion failed due to requirement '__is_abstract(int &)'}} \1036// expected-note@-1 {{'Ref' (aka 'int &') is not abstract}} \1037// expected-note@-1 {{because it is a reference type}} \1038// expected-note@-1 {{because it is not a struct or class type}}1039 1040using Ptr = int*;1041static_assert(__is_abstract(Ptr));1042// expected-error@-1 {{static assertion failed due to requirement '__is_abstract(int *)'}} \1043// expected-note@-1 {{'Ptr' (aka 'int *') is not abstract}} \1044// expected-note@-1 {{because it is a pointer type}} \1045// expected-note@-1 {{because it is not a struct or class type}}1046 1047union U { int x; float y;};1048static_assert(__is_abstract(U));1049// expected-error@-1 {{static assertion failed due to requirement '__is_abstract(is_abstract_tests::U)'}} \1050// expected-note@-1 {{'U' is not abstract}} \1051// expected-note@-1 {{because it is a union type}} \1052// expected-note@-1 {{because it is not a struct or class type}}1053 1054}1055