On Mon, 13 Dec 2021 at 05:14, Andrew Pinski wrote:
>
> On Sun, Dec 12, 2021 at 9:04 PM Nayan Deshmukh via Gcc <gcc@gcc.gnu.org> 
> wrote:
> > #include <iostream>
> > #include <stdint.h>
> > #include <cstddef>
> > struct A {
> >   int a;
> >   uint64_t b;
> >   int c = -1;
> > };
>
> The question becomes is the above a standard layout class or not. I
> Noticed clang does not change the rules for layout between C++11 and
> C++14 but GCC does.
> I don't know the exact rules in the ABI to help you there but I do
> think you should file a bug because it definitely looks unexpected
> really.

The C++14 behaviour started with https://gcc.gnu.org/r216750

   Implement N3653 (Member initializers and aggregates) and fix
references to 'this' in constexpr cons
tructors.

           Implement N3653 (Member initializers and aggregates) and fix
           references to 'this' in constexpr constructors.
           * class.c (check_field_decls): In C++14 an NSDMI does not make the
           class non-aggregate.

But I think the layout should be using "POD for the purpose of
layout", which means the C++98 POD rules. Please do report it to
bugzilla.

Reply via email to