[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 16:52:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88572
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Will Wray from comment #7)
> So, as to whether it should be a warning; I think not, but...
> for practical portability reasons, it probably should be left as a warning
> at least until some epoch like C++2a where both GCC & Clang could remove
> the warning under the -std=c++2a flag. Make sense?
No, I don't think so. I don't see why the warning should be given for C++11 but
not C++2a when the code is valid for both.
I think it should be accepted without a warning. I'd be more inclined to say it
should be accepted in C++98 with a -pedantic warning, rather than give a
warning for C++11.
> I wonder if the extra braces should have additional benefits like not
> allowing
> narrowing conversions. My limited experiments (on Clang) show no difference.
The outermost braces already mean it's a context that doesn't allow narrowing,
so the additional inner braces make no difference.
More information about the Gcc-bugs
mailing list