public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/77565] `typdef int Int;` --> did you mean `typeof`?
       [not found] <bug-77565-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-09 21:33 ` pinskia at gcc dot gnu.org
  2021-08-09 21:36 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-09 21:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
We don't give any suggestion any more:
<source>:1:1: error: 'typdef' does not name a type
 typdef int Int;
 ^~~~~~

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

* [Bug c++/77565] `typdef int Int;` --> did you mean `typeof`?
       [not found] <bug-77565-4@http.gcc.gnu.org/bugzilla/>
  2021-08-09 21:33 ` [Bug c++/77565] `typdef int Int;` --> did you mean `typeof`? pinskia at gcc dot gnu.org
@ 2021-08-09 21:36 ` pinskia at gcc dot gnu.org
  2021-09-11  4:00 ` mimomorin at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-09 21:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2016-09-12 00:00:00         |2021-8-9

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> We don't give any suggestion any more:

Never mind, I had use -std=c++98 with -std=gnu++98, get:
<source>:1:1: error: 'typdef' does not name a type; did you mean 'typeof'?
    1 | typdef int Int;
      | ^~~~~~
      | typeof

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

* [Bug c++/77565] `typdef int Int;` --> did you mean `typeof`?
       [not found] <bug-77565-4@http.gcc.gnu.org/bugzilla/>
  2021-08-09 21:33 ` [Bug c++/77565] `typdef int Int;` --> did you mean `typeof`? pinskia at gcc dot gnu.org
  2021-08-09 21:36 ` pinskia at gcc dot gnu.org
@ 2021-09-11  4:00 ` mimomorin at gmail dot com
  2021-09-11 21:07 ` mimomorin at gmail dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: mimomorin at gmail dot com @ 2021-09-11  4:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Michel Morin <mimomorin at gmail dot com> ---
There is a typo in this PR's Description. Here is a more readable one:

When we enable `typeof` GCC extension (e.g. using `-std=gnu++**` options), we
get strange did-you-mean suggestions.

`typdef int Int;` ->
    error: 'typdef' does not name a type; did you mean 'typeof'?

`typedeff int Int;` ->
    error: 'typedeff' does not name a type; did you mean 'typeof'?

Confirmed on GCC 11.2.

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

* [Bug c++/77565] `typdef int Int;` --> did you mean `typeof`?
       [not found] <bug-77565-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-09-11  4:00 ` mimomorin at gmail dot com
@ 2021-09-11 21:07 ` mimomorin at gmail dot com
  2021-09-13 18:04 ` mimomorin at gmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: mimomorin at gmail dot com @ 2021-09-11 21:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Michel Morin <mimomorin at gmail dot com> ---
It seems that the reason is:

`cp_keyword_starts_decl_specifier_p` in `cp/parser.c` does not include
`RID_TYPENAME`.

Note that `typedef` is a decl-specifier ([dcl.spec] p.1 in the Standard).

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

* [Bug c++/77565] `typdef int Int;` --> did you mean `typeof`?
       [not found] <bug-77565-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-09-11 21:07 ` mimomorin at gmail dot com
@ 2021-09-13 18:04 ` mimomorin at gmail dot com
  2021-09-14 12:24 ` dmalcolm at gcc dot gnu.org
  2021-09-23 20:26 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: mimomorin at gmail dot com @ 2021-09-13 18:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Michel Morin <mimomorin at gmail dot com> ---
Confirmed the fix. Will send a patch to ML.

> I had use -std=c++98

This comment helps me a lot to understand what's going on. Thanks!

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

* [Bug c++/77565] `typdef int Int;` --> did you mean `typeof`?
       [not found] <bug-77565-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2021-09-13 18:04 ` mimomorin at gmail dot com
@ 2021-09-14 12:24 ` dmalcolm at gcc dot gnu.org
  2021-09-23 20:26 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2021-09-14 12:24 UTC (permalink / raw)
  To: gcc-bugs

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

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

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

--- Comment #6 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Patch discussion:
  https://gcc.gnu.org/pipermail/gcc-patches/2021-September/579354.html

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

* [Bug c++/77565] `typdef int Int;` --> did you mean `typeof`?
       [not found] <bug-77565-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2021-09-14 12:24 ` dmalcolm at gcc dot gnu.org
@ 2021-09-23 20:26 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-23 20:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:eb9f099c3df2b1b4c5fb0fa25cfdfa3cb5fc817e

commit r12-3869-geb9f099c3df2b1b4c5fb0fa25cfdfa3cb5fc817e
Author: Michel Morin <mimomorin@gmail.com>
Date:   Thu Sep 16 23:29:54 2021 +0900

    c++: add spellcheck suggestions for typedef etc. [PR77565]

    cp_keyword_starts_decl_specifier_p misses many keywords that can
    start decl-specifiers. This patch adds support for those keywords.

            PR c++/77565

    gcc/cp/ChangeLog:

            * parser.c (cp_keyword_starts_decl_specifier_p): Handle more
            decl-specifiers (typedef/inline/cv/explicit/virtual/friend).

    gcc/testsuite/ChangeLog:

            * g++.dg/spellcheck-pr77565.C: New test.

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

end of thread, other threads:[~2021-09-23 20:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-77565-4@http.gcc.gnu.org/bugzilla/>
2021-08-09 21:33 ` [Bug c++/77565] `typdef int Int;` --> did you mean `typeof`? pinskia at gcc dot gnu.org
2021-08-09 21:36 ` pinskia at gcc dot gnu.org
2021-09-11  4:00 ` mimomorin at gmail dot com
2021-09-11 21:07 ` mimomorin at gmail dot com
2021-09-13 18:04 ` mimomorin at gmail dot com
2021-09-14 12:24 ` dmalcolm at gcc dot gnu.org
2021-09-23 20:26 ` cvs-commit 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).