[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / SemaCXX / has_unique_object_reps_member_ptr.cpp
blobb8e27f82ff38608ba19de2eb37f4be6b0ad2c9df
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
7 struct Base {};
8 struct A : virtual Base {
9 virtual void n() {}
12 auto p = &A::n;
13 static_assert(__has_unique_object_representations(decltype(p)));
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
23 static_assert(__has_unique_object_representations(B));
25 struct C { // has padding on Win32, but nothing else.
26 decltype(p) x;
28 #ifdef W32
29 static_assert(!__has_unique_object_representations(C));
30 #else
31 static_assert(__has_unique_object_representations(C));
32 #endif