aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/abi
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2022-01-21 11:16:49 -0500
committerJason Merrill <jason@redhat.com>2022-01-21 12:06:18 -0500
commit23be9f83bbd2c6f03580757adbfe599de6bf702b (patch)
tree93937d4a30606234ded38f014574e638855c8354 /gcc/testsuite/g++.dg/abi
parent45cae5b6392496028f35c5948f7fae0af81d135b (diff)
downloadgcc-23be9f83bbd2c6f03580757adbfe599de6bf702b.zip
gcc-23be9f83bbd2c6f03580757adbfe599de6bf702b.tar.gz
gcc-23be9f83bbd2c6f03580757adbfe599de6bf702b.tar.bz2
c++: [[no_unique_address]] and virtual base [PR104139]
Fixing a thinko in my patch for 103681: when computing the size of a virtual base, it would help to use its binfo instead of the one for the derived class. PR c++/104139 PR c++/103681 gcc/cp/ChangeLog: * class.cc (end_of_class): Use base_binfo. gcc/testsuite/ChangeLog: * g++.dg/abi/no_unique_address2.C: Adjust to detect this on x86-64.
Diffstat (limited to 'gcc/testsuite/g++.dg/abi')
-rw-r--r--gcc/testsuite/g++.dg/abi/no_unique_address2.C27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/abi/no_unique_address2.C b/gcc/testsuite/g++.dg/abi/no_unique_address2.C
index bef6d5b..3bb3f76 100644
--- a/gcc/testsuite/g++.dg/abi/no_unique_address2.C
+++ b/gcc/testsuite/g++.dg/abi/no_unique_address2.C
@@ -41,3 +41,30 @@ struct B4
#define SA(X) static_assert ((X), #X)
SA (sizeof (B2) == sizeof (B1));
SA (sizeof (B3) == sizeof (B4));
+
+namespace N2
+{
+ // C as big as _vptr to test PR c++/104139
+ struct C
+ {
+ long c;
+ };
+
+ struct D: virtual C
+ {
+ virtual void f();
+ };
+
+ struct B3: D
+ {
+ char c2;
+ };
+
+ struct B4
+ {
+ D d [[no_unique_address]];
+ char c2;
+ };
+
+ SA (sizeof (B3) == sizeof (B4));
+}