| 1 | // RUN: %clang_cc1 -triple x86_64-linux-pc -DIS64 -fsyntax-only -verify -std=c++17 %s |
| 2 | // RUN: %clang_cc1 -triple x86_64-windows-pc -DIS64 -fsyntax-only -verify -std=c++17 %s |
| 3 | // RUN: %clang_cc1 -triple i386-linux-pc -fsyntax-only -verify -std=c++17 %s |
| 4 | // RUN: %clang_cc1 -triple i386-windows-pc -DW32 -fsyntax-only -verify -std=c++17 %s |
| 5 | // expected-no-diagnostics |
| 6 | |
| 7 | struct Base {}; |
| 8 | struct A : virtual Base { |
| 9 | virtual void n() {} |
| 10 | }; |
| 11 | |
| 12 | auto p = &A::n; |
| 13 | static_assert(__has_unique_object_representations(decltype(p))); |
| 14 | |
| 15 | struct B { |
| 16 | decltype(p) x; |
| 17 | int b; |
| 18 | #ifdef IS64 |
| 19 | // required on 64 bit to fill out the tail padding. |
| 20 | int c; |
| 21 | #endif |
| 22 | }; |
| 23 | static_assert(__has_unique_object_representations(B)); |
| 24 | |
| 25 | struct C { // has padding on Win32, but nothing else. |
| 26 | decltype(p) x; |
| 27 | }; |
| 28 | #ifdef W32 |
| 29 | static_assert(!__has_unique_object_representations(C)); |
| 30 | #else |
| 31 | static_assert(__has_unique_object_representations(C)); |
| 32 | #endif |
| 33 | |