public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106040] New: gcc reports error in aggregate when member has explicit constructor
@ 2022-06-21  1:16 ldalessandro at gmail dot com
  2022-06-21  1:20 ` [Bug c++/106040] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ldalessandro at gmail dot com @ 2022-06-21  1:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106040
           Summary: gcc reports error in aggregate when member has
                    explicit constructor
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ldalessandro at gmail dot com
  Target Milestone: ---

gcc fails to compile the following example, as it seems to be treating .i{0} as
an implicit operation rather than an explicit construction. Both clang and MSVC
accept the example.

    struct foo {
        explicit foo(int) {}
    };

    struct bar {
        foo i;
    };

    bar x {
        .i{0} // <-- error:
    };

error: <source>:11:1: error: converting to 'foo' from initializer list would
use explicit constructor 'foo::foo(int)'

live: https://godbolt.org/z/hhvnGaK6c

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

* [Bug c++/106040] gcc reports error in aggregate when member has explicit constructor
  2022-06-21  1:16 [Bug c++/106040] New: gcc reports error in aggregate when member has explicit constructor ldalessandro at gmail dot com
@ 2022-06-21  1:20 ` pinskia at gcc dot gnu.org
  2022-06-21  1:20 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-06-21  1:20 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |10.1.0, 11.1.0, 12.1.0,
                   |                            |8.1.0, 9.1.0
           Keywords|                            |rejects-valid

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. Not a regression

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

* [Bug c++/106040] gcc reports error in aggregate when member has explicit constructor
  2022-06-21  1:16 [Bug c++/106040] New: gcc reports error in aggregate when member has explicit constructor ldalessandro at gmail dot com
  2022-06-21  1:20 ` [Bug c++/106040] " pinskia at gcc dot gnu.org
@ 2022-06-21  1:20 ` pinskia at gcc dot gnu.org
  2022-06-22  7:56 ` pj at patrickjohnston dot org
  2023-03-23 13:39 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-06-21  1:20 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-06-21

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

* [Bug c++/106040] gcc reports error in aggregate when member has explicit constructor
  2022-06-21  1:16 [Bug c++/106040] New: gcc reports error in aggregate when member has explicit constructor ldalessandro at gmail dot com
  2022-06-21  1:20 ` [Bug c++/106040] " pinskia at gcc dot gnu.org
  2022-06-21  1:20 ` pinskia at gcc dot gnu.org
@ 2022-06-22  7:56 ` pj at patrickjohnston dot org
  2023-03-23 13:39 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pj at patrickjohnston dot org @ 2022-06-22  7:56 UTC (permalink / raw)
  To: gcc-bugs

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

pj at patrickjohnston dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pj at patrickjohnston dot org

--- Comment #2 from pj at patrickjohnston dot org ---
Note that http://eel.is/c++draft/dcl.init.aggr#4.2
> the element is copy-initialized from the corresponding initializer-clause or is initialized with the brace-or-equal-initializer of the corresponding designated-initializer-clause
possibly suggests that copy initialisation semantics are used (meaning no
explicit conversion), dependent on if your interpretation agrees that the
"copy-initialized" bit still applies to the brace-or-equal-initializer bit

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

* [Bug c++/106040] gcc reports error in aggregate when member has explicit constructor
  2022-06-21  1:16 [Bug c++/106040] New: gcc reports error in aggregate when member has explicit constructor ldalessandro at gmail dot com
                   ` (2 preceding siblings ...)
  2022-06-22  7:56 ` pj at patrickjohnston dot org
@ 2023-03-23 13:39 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-03-23 13:39 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ppalka at gcc dot gnu.org
         Resolution|---                         |DUPLICATE

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
dup

*** This bug has been marked as a duplicate of bug 91319 ***

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

end of thread, other threads:[~2023-03-23 13:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-21  1:16 [Bug c++/106040] New: gcc reports error in aggregate when member has explicit constructor ldalessandro at gmail dot com
2022-06-21  1:20 ` [Bug c++/106040] " pinskia at gcc dot gnu.org
2022-06-21  1:20 ` pinskia at gcc dot gnu.org
2022-06-22  7:56 ` pj at patrickjohnston dot org
2023-03-23 13:39 ` 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).