Bug 91081 (cwg2120) - [DR 2120] Array as first non-static data member in standard-layout class
Summary: [DR 2120] Array as first non-static data member in standard-layout class
Status: NEW
Alias: cwg2120
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 10.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks: c++-core-issues
  Show dependency treegraph
 
Reported: 2019-07-03 22:12 UTC by Marek Polacek
Modified: 2024-04-05 02:52 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2024-04-04 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Polacek 2019-07-03 22:12:48 UTC
Cf. https://wg21.link/cwg2120

Test:

struct A {};
struct B : A {};
struct C { A a; };
struct D { C c[5]; };
struct E : B { D d; };
static_assert(__is_standard_layout(B), "");
static_assert(__is_standard_layout(D), "");
static_assert(!__is_standard_layout(E), "");