public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/116771] New: Missing suggestion on mispelled class name
@ 2024-09-18 20:08 dmalcolm at gcc dot gnu.org
  2024-09-18 20:11 ` [Bug c++/116771] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2024-09-18 20:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 116771
           Summary: Missing suggestion on mispelled class name
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: easyhack
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org
  Target Milestone: ---

I made this typo in C++:

class layout_printer
{
    void print_newline ();
};

void
layout_pirnter::print_newline ()
{
}

and noticed that we don't yet issue a suggestion for the missppelled class
name:

<source>:7:1: error: 'layout_pirnter' has not been declared
    7 | layout_pirnter::print_newline ()
      | ^~~~~~~~~~~~~~
Compiler returned: 1

whereas clang does:

<source>:7:1: error: use of undeclared identifier 'layout_pirnter'; did you
mean 'layout_printer'?
    7 | layout_pirnter::print_newline ()
      | ^~~~~~~~~~~~~~
      | layout_printer
<source>:1:7: note: 'layout_printer' declared here
    1 | class layout_printer
      |       ^
<source>:7:1: error: use of undeclared identifier 'layout_pirnter'; did you
mean 'layout_printer'?
    7 | layout_pirnter::print_newline ()
      | ^~~~~~~~~~~~~~
      | layout_printer
<source>:1:7: note: 'layout_printer' declared here
    1 | class layout_printer
      |       ^
2 errors generated.
Compiler returned: 1

See https://godbolt.org/z/q968ePqq9

I'm not sure why clang emits two errors, but that's for them to fix.
In the meantime, we should provide a suggestion for the misspelling.

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

* [Bug c++/116771] Missing suggestion on mispelled class name
  2024-09-18 20:08 [Bug c++/116771] New: Missing suggestion on mispelled class name dmalcolm at gcc dot gnu.org
@ 2024-09-18 20:11 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-09-18 20:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-09-18
           Severity|normal                      |enhancement
           Keywords|                            |diagnostic
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

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

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

end of thread, other threads:[~2024-09-18 20:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-18 20:08 [Bug c++/116771] New: Missing suggestion on mispelled class name dmalcolm at gcc dot gnu.org
2024-09-18 20:11 ` [Bug c++/116771] " pinskia 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).