view gcc/testsuite/g++.dg/ext/is_std_layout3.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

// DR 1813
// PR c++/83374 - __is_standard_layout wrong for a class with repeated bases.
// { dg-do compile { target c++11 } }

struct B { int i; };        // standard-layout class
struct C : B { };           // standard-layout class
struct D : C { };           // standard-layout class
struct E : D { char : 4; }; // not a standard-layout class
static_assert( __is_standard_layout(B), "" );
static_assert( __is_standard_layout(C), "" );
static_assert( __is_standard_layout(D), "" );
static_assert( ! __is_standard_layout(E), "" );

struct Q {};
struct S : Q { };
struct T : Q { };
struct U : S, T { };         // not a standard-layout class
static_assert( ! __is_standard_layout(U), "" );