[Bug c++/91064] New: __is_standard_layout incorrect for a class with multiple bases
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jul 2 20:35:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91064
Bug ID: 91064
Summary: __is_standard_layout incorrect for a class with
multiple bases
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
According to class.prop in N4800:
A class S is a standard-layout class if it:
...
(3.5) -- has at most one base class subobject of any given type
The test case below is taken from the example in paragraph 4 in that section.
The GCC traits reports that class U is standard layout, in violation of the
spec. (Clang does the same.)
$ cat x.C && gcc -S -Wall x.C
struct Q { };
struct S { };
struct T { };
struct U: S, T { }; // not a standard-layout class
static_assert (!__is_standard_layout (U));
x.C:6:16: error: static assertion failed
6 | static_assert (!__is_standard_layout (U));
| ^~~~~~~~~~~~~~~~~~~~~~~~~
More information about the Gcc-bugs
mailing list