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
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).