Bug 92812 - Implement P1975R0: Fixing the wording of parenthesized aggregate-initialization
Summary: Implement P1975R0: Fixing the wording of parenthesized aggregate-initialization
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Marek Polacek
Depends on:
Blocks: c++20-core
  Show dependency treegraph
Reported: 2019-12-04 23:13 UTC by Marek Polacek
Modified: 2020-02-04 19:50 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2020-01-30 00:00:00


Note You need to log in before you can comment on or make changes to this bug.
Description Marek Polacek 2019-12-04 23:13:01 UTC
As per

This wasn't included in my patch for P0960.
Comment 1 Jason Merrill 2020-02-04 16:47:50 UTC
Another missing piece:

struct A
  int ar[2];
  A(): ar(1,2) {} // should work, I think
Comment 2 Marek Polacek 2020-02-04 19:17:08 UTC
Comment 3 CVS Commits 2020-02-04 19:50:16 UTC
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:


commit r10-6436-ga1c9c9ff06ab15e697d5bac6ea6e5da2df840cf5
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Feb 4 14:21:59 2020 -0500

    c++: Fix ({ ... }) array mem-initializer.
    Here, we were going down the wrong path in perform_member_init because of
    the incorrect parens around the mem-initializer for the array.  And then
    cxx_eval_vec_init_1 didn't know what to do with a CONSTRUCTOR as the
    initializer.  The latter issue was a straightforward fix, but I also wanted
    to fix us silently accepting the parens, which led to factoring out handling
    of TREE_LIST and flexarrays.  The latter led to adjusting the expected
    behavior on flexary29.C: we should complain about the initializer, but not
    complain about a missing initializer.
    As I commented on PR 92812, in this process I noticed that we weren't
    handling C++20 parenthesized aggregate initialization as a mem-initializer.
    So my TREE_LIST handling includes a commented out section that should
    probably be part of a future fix for that issue; with it uncommented we
    continue to crash on the testcase in C++20 mode, but should instead complain
    about the braced-init-list not being a valid initializer for an A.
    	PR c++/86917
    	* init.c (perform_member_init): Simplify.
    	* constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
    	(cxx_eval_vec_init_1): Handle CONSTRUCTOR.