Bug 114460 - [C++26] P3106R1 - Clarifying rules for brace elision in aggregate initialization
Summary: [C++26] P3106R1 - Clarifying rules for brace elision in aggregate initialization
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 14.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks: c++-core-issues c++26-core
  Show dependency treegraph
 
Reported: 2024-03-25 11:14 UTC by Jakub Jelinek
Modified: 2024-07-19 07:17 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2024-03-25 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2024-03-25 11:14:32 UTC
See <https://wg21.link/P3106R1>.

DR for C++98 and up.
Comment 1 Marek Polacek 2024-03-25 17:18:43 UTC
Confirmed.  I'm interested.
Comment 2 Jason Merrill 2024-04-13 01:37:42 UTC
This paper was intended to correct the specification of existing behavior, so no compiler changes should be necessary, but we should verify that.
Comment 3 GCC Commits 2024-07-19 06:55:03 UTC
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:cea6473e48b4cfbf16f7b4a804f1562f8da8f25b

commit r15-2152-gcea6473e48b4cfbf16f7b4a804f1562f8da8f25b
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Jul 19 08:53:47 2024 +0200

    c++: Add [dcl.init.aggr] examples to testsuite
    
    When working on the #embed optimization support, I went recently through
    all of reshape_init_r* and today I read in detail all the P3106R1 changes
    and I believe we implement it that way for years.
    To double check that, I've added tests with the current [dcl.init.aggr]
    examples but tested in all the languages from C++98 to C++26, of course
    guarded as needed for constructs which require newer versions of C++.
    The examples come in two tests, one is a runtime test for the non-erroneous
    examples, the other is a compile time test for the diagnostics.
    The former one includes mostly intact examples with runtime checking (both
    to test what is written in the section exactly and to test at least
    something with C++98) and then when useful also adds constexpr tests with
    static_asserts for C++11 and later.
    
    Tested on x86_64-linux and i686-linux with
    GXX_TESTSUITE_STDS=98,11,14,17,20,23,26 make check-g++ RUNTESTFLAGS='dg.exp=aggr-init*.C'
    
    Also tested on GCC 11 branch with
    GXX_TESTSUITE_STDS=98,11,14,17,20,2b make check-g++ RUNTESTFLAGS='dg.exp=aggr-init*.C'
    where just the " is a GCC extension" part of one error is left out,
    otherwise it passes the same, ditto with clang 14 (of course with different
    diagnostics, but verified it emits diagnostics on the right lines), so I
    believe we can claim implementation of this DR paper, either in all versions
    or at least in GCC 11+.
    
    2024-07-19  Jakub Jelinek  <jakub@redhat.com>
    
            PR c++/114460
            * g++.dg/cpp26/aggr-init1.C: New test.
            * g++.dg/cpp26/aggr-init2.C: New test.
Comment 4 Jakub Jelinek 2024-07-19 07:08:20 UTC
I've additionally tested GCC 11.5, GCC 8.5 and GCC 4.8.5 and the aggr-init1.C test passes in all language variants that support it, had to tweak slightly the second testcase because of differences in in effective target and dejagnu directive format support and in the 4.8 case also for wording of one case, but otherwise it passed.
So, I'm committing a Yes rather than a specific version which implemented this to cxx-status.html.
Comment 5 Jakub Jelinek 2024-07-19 07:17:59 UTC
Also tested GCC 4.1 and 3.2 (that time only in C++98) and it also works expectedly.