[Bug c++/72775] [6/7 Regression] internal compiler error: in finish_expr_stmt, at cp/semantics.c:677

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Aug 15 17:25:00 GMT 2016


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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #3)
> (In reply to Marek Polacek from comment #1)
> > But before r233183 this code compiled fine.
> 
> It didn't do what one would expect at runtime, though, and neither did a
> program that used the aggregate initialization (i.e., struct S { bool b;
> char a[]; } s = { 1, "foo" };) because it treated the flexible array member
> as a zero-length array.  With the flexible array member improvements
> committed in 6.0, GCC accepts the latter, so it seems that the original test
> case should be accepted as well, as an extension.  I.e., I suggest to treat
> this as ice-on-valid code.

But the initialization happens in the default constructor, whereas allocating
space for the object happens before the constructor.  I don't think we should
try to support initialization of a flexible array member in a constructor.


More information about the Gcc-bugs mailing list