public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115114] New: aggregate initialization with parens fails when there is a base class
@ 2024-05-15 20:52 eric.niebler at gmail dot com
  2024-05-17  4:47 ` [Bug c++/115114] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: eric.niebler at gmail dot com @ 2024-05-15 20:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115114
           Summary: aggregate initialization with parens fails when there
                    is a base class
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eric.niebler at gmail dot com
  Target Milestone: ---

I believe the following is valid C++20:

  struct get_answer {};

  template <class Query, class Value>
  struct with : Query {
    Value value;
  };

  int main() {
    with w1{get_answer(), 42}; // works

    with w2(get_answer(), 42); // fails
  }

clang and msvc accept this code. gcc-trunk rejects it. See
https://godbolt.org/z/KvGjn47f9.

If I change the definition of the `with` class template to the following, the
code compiles:

  template <class Query, class Value>
  struct with {
    Query query;
    Value value;
  };

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-05-20 13:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-15 20:52 [Bug c++/115114] New: aggregate initialization with parens fails when there is a base class eric.niebler at gmail dot com
2024-05-17  4:47 ` [Bug c++/115114] " pinskia at gcc dot gnu.org
2024-05-17 13:03 ` cvs-commit at gcc dot gnu.org
2024-05-20 13:51 ` cvs-commit at gcc dot gnu.org
2024-05-20 13:53 ` ppalka at gcc dot gnu.org

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).