[Bug c++/91080] New: [DR 1672] Layout compatibility with multiple empty bases
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jul 3 22:11:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91080
Bug ID: 91080
Summary: [DR 1672] Layout compatibility with multiple empty
bases
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
Target Milestone: ---
Cf. https://wg21.link/cwg1672
Test (from the clang testsuite):
struct Empty {};
struct A : Empty {};
struct B { Empty e; };
struct C : A { B b; int n; };
struct D : A { int n; B b; };
static_assert(!__is_standard_layout(C), "");
static_assert(__is_standard_layout(D), "");
struct E { B b; int n; };
struct F { int n; B b; };
union G { B b; int n; };
union H { int n; B b; };
struct X {};
template<typename T> struct Y : X, A { T t; };
static_assert(!__is_standard_layout(Y<E>), "");
static_assert(__is_standard_layout(Y<F>), "");
static_assert(!__is_standard_layout(Y<G>), "");
static_assert(!__is_standard_layout(Y<H>), "");
static_assert(!__is_standard_layout(Y<X>), "");
More information about the Gcc-bugs
mailing list