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

--- Comment #7 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Jonny Grant from comment #6)
> Tried a few other compilers on godbolt. 
> 
> ICC gets the warning on line 6
> https://godbolt.org/z/fYb9c8f61
> 
> nvc++ gives the warning on line 6 
> https://godbolt.org/z/xvh67odzY
> 
> MSVC and Clang don't.

This is just blind luck.  All of these compilers attempt to "fix" the syntax
error by adding "}" at line 8 (not line 6!) and produce further warnings.  It's
just ICC and nvc++ report "excess elements in initializer" at the beginning of
the initializer, while the other compilers report it at the end.

Strictly speaking all of them are false warnings as there is no excess elements
in the initializer (according to the programmer's mind).  But the only thing
the parser can do is guessing the programmer wanted a "}" at line 8.

Reply via email to