xref: /llvm-project/clang/test/SemaCXX/cxx2a-no-unique-address.cpp (revision 62328f2f29b432dadbd327ff91ba3914c478e3fc)
178b239eaSRichard Smith // RUN: %clang_cc1 -std=c++2a %s -verify -triple x86_64-linux-gnu
278b239eaSRichard Smith // RUN: %clang_cc1 -std=c++2a %s -verify=unsupported -triple x86_64-windows
378b239eaSRichard Smith 
478b239eaSRichard Smith [[no_unique_address]] int a; // expected-error {{only applies to non-bit-field non-static data members}} unsupported-warning {{unknown}}
578b239eaSRichard Smith [[no_unique_address]] void f(); // expected-error {{only applies to non-bit-field non-static data members}} unsupported-warning {{unknown}}
678b239eaSRichard Smith struct [[no_unique_address]] S { // expected-error {{only applies to non-bit-field non-static data members}} unsupported-warning {{unknown}}
778b239eaSRichard Smith   [[no_unique_address]] int a; // unsupported-warning {{unknown}}
878b239eaSRichard Smith   [[no_unique_address]] void f(); // expected-error {{only applies to non-bit-field non-static data members}} unsupported-warning {{unknown}}
978b239eaSRichard Smith   [[no_unique_address]] static int sa;// expected-error {{only applies to non-bit-field non-static data members}} unsupported-warning {{unknown}}
1078b239eaSRichard Smith   [[no_unique_address]] static void sf(); // expected-error {{only applies to non-bit-field non-static data members}} unsupported-warning {{unknown}}
1178b239eaSRichard Smith   [[no_unique_address]] int b : 3; // expected-error {{only applies to non-bit-field non-static data members}} unsupported-warning {{unknown}}
1278b239eaSRichard Smith 
13*62328f2fSAaron Ballman   [[no_unique_address, no_unique_address]] int duplicated; // ok
14*62328f2fSAaron Ballman   // unsupported-warning@-1 2{{unknown}}
1578b239eaSRichard Smith   [[no_unique_address]] [[no_unique_address]] int duplicated2; // unsupported-warning 2{{unknown}}
1678b239eaSRichard Smith   [[no_unique_address()]] int arglist; // expected-error {{cannot have an argument list}} unsupported-warning {{unknown}}
1778b239eaSRichard Smith 
1878b239eaSRichard Smith   int [[no_unique_address]] c; // expected-error {{cannot be applied to types}} unsupported-error {{cannot be applied to types}}
1978b239eaSRichard Smith };
20