diff options
author | Marek Polacek <polacek@redhat.com> | 2024-04-05 13:40:33 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2024-04-05 13:40:55 -0400 |
commit | 2b2d3a135a43cbafadd8957e0b2543f38c390437 (patch) | |
tree | 105dde68073fe62125b215fb9e5f6a03013c9f85 | |
parent | e7d015b2506a1d9e84d9f7182e42e097147527e1 (diff) | |
download | gcc-2b2d3a135a43cbafadd8957e0b2543f38c390437.zip gcc-2b2d3a135a43cbafadd8957e0b2543f38c390437.tar.gz gcc-2b2d3a135a43cbafadd8957e0b2543f38c390437.tar.bz2 |
c++: add fixed test [PR91079]
Fixed by r12-2975.
PR c++/91079
DR 1881
gcc/testsuite/ChangeLog:
* g++.dg/ext/is_std_layout5.C: New test.
-rw-r--r-- | gcc/testsuite/g++.dg/ext/is_std_layout5.C | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/ext/is_std_layout5.C b/gcc/testsuite/g++.dg/ext/is_std_layout5.C new file mode 100644 index 0000000..875f3c0 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/is_std_layout5.C @@ -0,0 +1,13 @@ +// PR c++/91079 +// DR 1881 - Standard-layout classes and unnamed bit-fields +// { dg-do compile { target c++11 } } + +struct A { int a : 4; }; +struct B : A { int b : 3; }; +static_assert(__is_standard_layout(A), ""); +static_assert(!__is_standard_layout(B), ""); + +struct C { int : 0; }; +struct D : C { int : 0; }; +static_assert(__is_standard_layout(C), ""); +static_assert(!__is_standard_layout(D), ""); |