[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / SemaCXX / has_unique_object_reps_no_unique_addr.cpp
bloba64ca8277a1ebe1d93e7dabd97b8025a133da902
1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify -std=c++2a %s
2 // expected-no-diagnostics
4 struct Empty {};
6 struct A {
7 [[no_unique_address]] Empty e;
8 char x;
9 };
11 static_assert(__has_unique_object_representations(A));
13 struct B {
14 char x;
15 [[no_unique_address]] Empty e;
18 static_assert(__has_unique_object_representations(B));
20 struct C {
21 char x;
22 [[no_unique_address]] Empty e1;
23 [[no_unique_address]] Empty e2;
26 static_assert(!__has_unique_object_representations(C));
28 namespace TailPaddingReuse {
29 struct A {
30 private:
31 int a;
33 public:
34 char b;
37 struct B {
38 [[no_unique_address]] A a;
39 char c[3];
41 } // namespace TailPaddingReuse
42 static_assert(__has_unique_object_representations(TailPaddingReuse::B));