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

Will Wray <wjwray at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wjwray at gmail dot com

--- Comment #15 from Will Wray <wjwray at gmail dot com> ---
Created attachment 45683
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45683&action=edit
Proposed patch including updated tests

Accept braces around scalar initializer within aggregate init,
previously rejected; this patch accepts without a warning.

Reject braced empty-brace value-initialization of scalar variable
previously accepted.

Maintain C++98 rejection of scalar braced-init.

See Bug 88572 for details, standards links and extra test code.

Log:
        PR c++/88572
        * decl.c (reshape_init_r): Remove condition that was incorrectly
        rejecting braces around scalar initializer within aggregate init. 
        Produce no warning. Replace with condition rejecting braced-init
        of scalar variable, including empty-brace value-initialization
        that was being incorrectly accepted. Produce same error for both.

        PR c++/88572
        * g++.dg/cpp0x/initlist69.C: Update 2 tests; changed error, OK.
        * g++.dg/cpp1z/direct-enum-init1.C: Update 3 tests; changed error.
        * g++.dg/init/brace1.C: Update 1 test; error only on c++98. Add
          1 test with one more set of braces; error on too many braces.
        * g++.dg/init/brace2.C: Add 1 test; empty-brace scalar init fail.
        * g++.dg/init/union2.C: Update 1 test; error only on c++98. Add
          1 test with one more set of braces; error on too many braces.
        * g++.dg/warn/Wbraces2.C: Update 3 test; 1 error only on c++98.
          2 now give invalid conversion instead of braces error on >98.

Reply via email to