public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111247] New: Very confusing diagnostic when attempting to initialize an incomplete type: "too many initializers"
@ 2023-08-30 21:06 chgros at synopsys dot com
  2023-08-30 21:16 ` [Bug c++/111247] " pinskia at gcc dot gnu.org
  2023-08-31 13:33 ` mpolacek at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: chgros at synopsys dot com @ 2023-08-30 21:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111247
           Summary: Very confusing diagnostic when attempting to
                    initialize an incomplete type: "too many initializers"
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chgros at synopsys dot com
  Target Milestone: ---

Compiling this code with g++ 12 gives a very misleading diagnostic when
attempting to initialize an incomplete type:

class Incomplete;
void use(Incomplete &&);

void bad()
{
    use(Incomplete{0, 2});
}

error: too many initializers for 'Incomplete'
    7 |     use(Incomplete{0, 2});

It took me a while to figure out I was missing a header.

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

* [Bug c++/111247] Very confusing diagnostic when attempting to initialize an incomplete type: "too many initializers"
  2023-08-30 21:06 [Bug c++/111247] New: Very confusing diagnostic when attempting to initialize an incomplete type: "too many initializers" chgros at synopsys dot com
@ 2023-08-30 21:16 ` pinskia at gcc dot gnu.org
  2023-08-31 13:33 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-30 21:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-08-30
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC 7 and before used to also provide:
```
<source>:7:23: error: invalid use of incomplete type 'class Incomplete'
<source>:2:7: note: forward declaration of 'class Incomplete'
 class Incomplete;
       ^~~~~~~~~~
```

Confirmed.

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

* [Bug c++/111247] Very confusing diagnostic when attempting to initialize an incomplete type: "too many initializers"
  2023-08-30 21:06 [Bug c++/111247] New: Very confusing diagnostic when attempting to initialize an incomplete type: "too many initializers" chgros at synopsys dot com
  2023-08-30 21:16 ` [Bug c++/111247] " pinskia at gcc dot gnu.org
@ 2023-08-31 13:33 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-08-31 13:33 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Changed in r247630 probably.

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

end of thread, other threads:[~2023-08-31 13:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-30 21:06 [Bug c++/111247] New: Very confusing diagnostic when attempting to initialize an incomplete type: "too many initializers" chgros at synopsys dot com
2023-08-30 21:16 ` [Bug c++/111247] " pinskia at gcc dot gnu.org
2023-08-31 13:33 ` mpolacek 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).