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

wjwray at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Feb 4 22:57:00 GMT 2019


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

--- Comment #14 from Will Wray <wjwray at gmail dot com> ---
I intend to submit a patch, or two patches, for these scalar braced init
issues:

Case 1: GCC rejects braced-init of scalars in aggregates. It should accept.
Case 2: GCC accepts empty braced-init of scalars (comment 13). It should
reject.

Fixing case 2 has the potential to break code.
Such broken code is already rejected by Clang and MSVC.
It seems unlikely that there will be any examples of this in the wild.

Both case 1 and case 2 are fixed by the patch in comment 9.
The patch needs to be updated to give a warning only when appropriate.

I plan to submit a single patch to fix both issues.
A more cautious approach would be to submit 2 separate patches.
Please speak now if you'd prefer to see 2 patches.


More information about the Gcc-bugs mailing list