[Bug c++/88572] error: braces around scalar initializer - should be a warning

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 7 23:57:00 GMT 2019


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

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Will Wray from comment #9)
> The patch below seems to work as far as I've tested - please review.
> 
> It looks like the bool first_initializer_p argument to reshape_init_r
> gives the context that is needed, according to the function comment;
> 
> /* ...
>    FIRST_INITIALIZER_P is true if this is the first initializer of the
>    outermost CONSTRUCTOR node.  */
> 
> If I read this right then this bool arg is true for scalar init and
> false when initializing a scalar member of an aggregate (class or array).

I understood it to mean something like {{1}, 2} is the first,
                                        ^^^
but apparently not. The patch works for me, but I can't review it properly.


More information about the Gcc-bugs mailing list