https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77314

--- Comment #2 from Harald van Dijk <harald at gigawatt dot nl> ---
(In reply to Harald van Dijk from comment #1)
> A workaround for current GCC versions is to use an array of size 1.

That, by the way, shows an existing code generation problem:

  struct S { S(); };
  struct T { struct { S s[1]; }; } t;

does not call S's constructor when compiled with GCC, but does call it when
compiled with clang. In my opinion, this should be accepted as an extension and
call the constructor. Similarly, if GCC is changed to accept

  struct S { S(); };
  struct T { struct { S s; }; } t;

it should also call the constructor. And errors should be generated for

  struct S { S(); };
  union U { struct { S s; }; } u;

and

  struct S { S(); };
  union U { struct { S s[1]; }; } u; // currently accepted

while

  struct S { S(); };
  union U { struct { S s; }; } *pu;

should be okay.

Reply via email to