public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114977] New: C++20 parenthesized aggregate initialization copy-inits from {} instead of value-init
@ 2024-05-07 17:16 mital at mitalashok dot co.uk
  0 siblings, 0 replies; only message in thread
From: mital at mitalashok dot co.uk @ 2024-05-07 17:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114977
           Summary: C++20 parenthesized aggregate initialization
                    copy-inits from {} instead of value-init
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mital at mitalashok dot co.uk
  Target Milestone: ---

When implementing <https://wg21.link/P0960R3>, unlike when initializing with
aggregate initialization where each element that is not explicitly initialized
is initialized from `{}` (<https://wg21.link/dcl.init.aggr#5.2>), when
direct-initializing they should be value-initialized
(<https://wg21.link/dcl.init.general#16.6.2.2.sentence-6> for aggregate
classes, <https://wg21.link/dcl.init.general#16.5.sentence-7>).

It seems like GCC initializes from `{}` anyways, as seen by this compiling
<https://godbolt.org/z/T3r54Wxnc>:

    #include <initializer_list>
    struct A {
        A(std::initializer_list<void*>);
    };
    A a[3]({}, {});  // a[2] should be value-initialized and fail
    struct B {
        int i;
        A a;
    };
    B b(1);  // b.a should be value-initialized and fail

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-07 17:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-07 17:16 [Bug c++/114977] New: C++20 parenthesized aggregate initialization copy-inits from {} instead of value-init mital at mitalashok dot co.uk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).