public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101818] New: Error message for the wrong name in designated initializers could be improved
@ 2021-08-08 11:26 hewillk at gmail dot com
  2021-08-08 15:39 ` [Bug c++/101818] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hewillk at gmail dot com @ 2021-08-08 11:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101818
           Summary: Error message for the wrong name in designated
                    initializers could be improved
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

Consider: https://godbolt.org/z/8xrocoTcG

struct Op { int a, b; };
Op op{.a = 0,
      .x = 0,


      .b = 0};


Clang rejects with:
<source>:3:8: error: field designator 'x' does not refer to any field in type
'Op'
      .x = 0,
       ^
However, GCC rejects with:
<source>:6:13: error: 'Op' has no non-static data member named 'x'
    6 |       .b = 0};
      |             ^


It would be less confusing and more user-friendly if the cursor can actually
point to the x.

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

* [Bug c++/101818] Error message for the wrong name in designated initializers could be improved
  2021-08-08 11:26 [Bug c++/101818] New: Error message for the wrong name in designated initializers could be improved hewillk at gmail dot com
@ 2021-08-08 15:39 ` pinskia at gcc dot gnu.org
  2021-08-11  7:46 ` hewillk at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-08 15:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is a dup of bug 95085.

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

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

* [Bug c++/101818] Error message for the wrong name in designated initializers could be improved
  2021-08-08 11:26 [Bug c++/101818] New: Error message for the wrong name in designated initializers could be improved hewillk at gmail dot com
  2021-08-08 15:39 ` [Bug c++/101818] " pinskia at gcc dot gnu.org
@ 2021-08-11  7:46 ` hewillk at gmail dot com
  2021-11-22  9:38 ` redi at gcc dot gnu.org
  2021-11-22  9:41 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: hewillk at gmail dot com @ 2021-08-11  7:46 UTC (permalink / raw)
  To: gcc-bugs

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

康桓瑋 <hewillk at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|DUPLICATE                   |---
             Status|RESOLVED                    |UNCONFIRMED

--- Comment #2 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> This is a dup of bug 95085.
> 
> *** This bug has been marked as a duplicate of bug 95085 ***

I don't think this is a dup of PR 95085. In 95085, Barry described the error
message for this case as "gcc's diagnostic is absolutely excellent", but it is
obviously misleading.

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

* [Bug c++/101818] Error message for the wrong name in designated initializers could be improved
  2021-08-08 11:26 [Bug c++/101818] New: Error message for the wrong name in designated initializers could be improved hewillk at gmail dot com
  2021-08-08 15:39 ` [Bug c++/101818] " pinskia at gcc dot gnu.org
  2021-08-11  7:46 ` hewillk at gmail dot com
@ 2021-11-22  9:38 ` redi at gcc dot gnu.org
  2021-11-22  9:41 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-22  9:38 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-11-22
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Confirming for the missing location in the caret diagnostic.

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

* [Bug c++/101818] Error message for the wrong name in designated initializers could be improved
  2021-08-08 11:26 [Bug c++/101818] New: Error message for the wrong name in designated initializers could be improved hewillk at gmail dot com
                   ` (2 preceding siblings ...)
  2021-11-22  9:38 ` redi at gcc dot gnu.org
@ 2021-11-22  9:41 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-22  9:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=90475

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Almost a dup of another bug from Barry though: PR 90475

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

end of thread, other threads:[~2021-11-22  9:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-08 11:26 [Bug c++/101818] New: Error message for the wrong name in designated initializers could be improved hewillk at gmail dot com
2021-08-08 15:39 ` [Bug c++/101818] " pinskia at gcc dot gnu.org
2021-08-11  7:46 ` hewillk at gmail dot com
2021-11-22  9:38 ` redi at gcc dot gnu.org
2021-11-22  9:41 ` redi 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).