public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95723] New: GCC get confused while parsing a code
@ 2020-06-17 15:56 haoxintu at gmail dot com
  2020-06-17 17:43 ` [Bug c++/95723] " marxin at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: haoxintu at gmail dot com @ 2020-06-17 15:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95723
           Summary: GCC get confused while parsing a code
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

This code test.cc, GCC might get confused in parsing.

$cat test.cc
template <a> friend foo ( decltype (b=c

$g++-trunk -w test.cc
test.cc:1:12: error: ‘a’ has not been declared
    1 | template  <a>friend foo( decltype (b=c
      |            ^
test.cc:1:14: error: ‘friend’ used outside of class
    1 | template  <a>friend foo( decltype (b=c
      |              ^~~~~~
      |              ------
test.cc:1:36: error: ‘b’ was not declared in this scope
    1 | template  <a>friend foo( decltype (b=c
      |                                    ^
test.cc:1:36: error: ‘b’ was not declared in this scope
test.cc:1:38: error: ‘c’ was not declared in this scope
    1 | template  <a>friend foo( decltype (b=c
      |                                      ^
test.cc:2: error: expected ‘,’ or ‘...’ at end of input
test.cc:1:39: error: expected ‘)’ at end of input
    1 | template  <a>friend foo( decltype (b=c
      |                        ~              ^
      |                                       )
test.cc:2: error: expected initializer at end of input


$g++-10 -w test.cc
test.cc:1:12: error: ‘a’ has not been declared
    1 | template  <a>friend foo( decltype (b=c
      |            ^
test.cc:1:14: error: ‘friend’ used outside of class
    1 | template  <a>friend foo( decltype (b=c
      |              ^~~~~~
      |              ------
test.cc:1:36: error: ‘b’ was not declared in this scope
    1 | template  <a>friend foo( decltype (b=c
      |                                    ^
test.cc:1:36: error: ‘b’ was not declared in this scope
test.cc:1:38: error: ‘c’ was not declared in this scope
    1 | template  <a>friend foo( decltype (b=c
      |                                      ^
test.cc:1:36: error: ‘b’ was not declared in this scope
    1 | template  <a>friend foo( decltype (b=c
      |                                    ^
test.cc:1:36: error: ‘b’ was not declared in this scope
test.cc:1:38: error: ‘c’ was not declared in this scope
    1 | template  <a>friend foo( decltype (b=c
      |                                      ^
test.cc:1:36: error: ‘b’ was not declared in this scope
    1 | template  <a>friend foo( decltype (b=c
      |                                    ^
test.cc:1:36: error: ‘b’ was not declared in this scope
test.cc:1:38: error: ‘c’ was not declared in this scope
    1 | template  <a>friend foo( decltype (b=c
      |                                      ^
test.cc:1:21: error: ISO C++ forbids declaration of ‘foo’ with no type
[-fpermissive]
    1 | template  <a>friend foo( decltype (b=c
      |                     ^~~
test.cc:1:36: error: ‘b’ was not declared in this scope
    1 | template  <a>friend foo( decltype (b=c
      |                                    ^
test.cc:1:36: error: ‘b’ was not declared in this scope
test.cc:1:38: error: ‘c’ was not declared in this scope
    1 | template  <a>friend foo( decltype (b=c
      |                                      ^
test.cc:1:39: error: expected ‘)’ at end of input
    1 | template  <a>friend foo( decltype (b=c
      |                                   ~  ~^
      |                                       )
test.cc:1:26: error: expected primary-expression before ‘decltype’
    1 | template  <a>friend foo( decltype (b=c
      |                          ^~~~~~~~~~~~~
test.cc:1:39: error: expected ‘;’ at end of input
    1 | template  <a>friend foo( decltype (b=c
      |                          ~~~~~~~~~~~~~^
      |                                       ;

I am sure that some error messages in GCC-10 are duplicated. I am also
wondering why GCC-trunk emits "error: expected initializer at end of input",
that's so confusing.

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

* [Bug c++/95723] GCC get confused while parsing a code
  2020-06-17 15:56 [Bug c++/95723] New: GCC get confused while parsing a code haoxintu at gmail dot com
@ 2020-06-17 17:43 ` marxin at gcc dot gnu.org
  2020-06-17 17:44 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-06-17 17:43 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

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

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
For the next time, can you please add 'ice-on-invalid-code' keyword?

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

* [Bug c++/95723] GCC get confused while parsing a code
  2020-06-17 15:56 [Bug c++/95723] New: GCC get confused while parsing a code haoxintu at gmail dot com
  2020-06-17 17:43 ` [Bug c++/95723] " marxin at gcc dot gnu.org
@ 2020-06-17 17:44 ` marxin at gcc dot gnu.org
  2020-06-17 23:44 ` mpolacek at gcc dot gnu.org
  2021-12-17  5:34 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-06-17 17:44 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Note that we have a gazillion of error recovery issues for C++ FE.

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

* [Bug c++/95723] GCC get confused while parsing a code
  2020-06-17 15:56 [Bug c++/95723] New: GCC get confused while parsing a code haoxintu at gmail dot com
  2020-06-17 17:43 ` [Bug c++/95723] " marxin at gcc dot gnu.org
  2020-06-17 17:44 ` marxin at gcc dot gnu.org
@ 2020-06-17 23:44 ` mpolacek at gcc dot gnu.org
  2021-12-17  5:34 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-17 23:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This code is so hopelessly broken that I'm not sure how we could generate
better diagnostics.  clang doesn't issue anything better.  I'm tempted to
WONTFIX this.

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

* [Bug c++/95723] GCC get confused while parsing a code
  2020-06-17 15:56 [Bug c++/95723] New: GCC get confused while parsing a code haoxintu at gmail dot com
                   ` (2 preceding siblings ...)
  2020-06-17 23:44 ` mpolacek at gcc dot gnu.org
@ 2021-12-17  5:34 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-17  5:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-12-17
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Severity|normal                      |enhancement

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

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

end of thread, other threads:[~2021-12-17  5:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-17 15:56 [Bug c++/95723] New: GCC get confused while parsing a code haoxintu at gmail dot com
2020-06-17 17:43 ` [Bug c++/95723] " marxin at gcc dot gnu.org
2020-06-17 17:44 ` marxin at gcc dot gnu.org
2020-06-17 23:44 ` mpolacek at gcc dot gnu.org
2021-12-17  5:34 ` 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).