public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97446] New: gcc accepts an unnamed struct
@ 2020-10-15 14:19 tangyixuan at mail dot dlut.edu.cn
2020-10-15 14:23 ` [Bug c++/97446] " jakub at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: tangyixuan at mail dot dlut.edu.cn @ 2020-10-15 14:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97446
Bug ID: 97446
Summary: gcc accepts an unnamed struct
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tangyixuan at mail dot dlut.edu.cn
Target Milestone: ---
Hi, the following code has an error in 'S3' (maybe should be 'S2'). gcc accepts
it without error diagnostics.
$ cat s.cpp
template < class T > struct S1 {
struct S2 {
friend struct S1 <T>::S3;
};
};
$ clang++ -c s.cpp
s.cpp:3:32: error: no struct named 'S3' in 'S1<T>'
friend struct S1 <T>::S3;
~~~~~~~~^
1 error generated.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/97446] gcc accepts an unnamed struct
2020-10-15 14:19 [Bug c++/97446] New: gcc accepts an unnamed struct tangyixuan at mail dot dlut.edu.cn
@ 2020-10-15 14:23 ` jakub at gcc dot gnu.org
2020-10-15 14:46 ` redi at gcc dot gnu.org
2020-10-26 16:53 ` mpolacek at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-10-15 14:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97446
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The template isn't instantiated, so whether you get or don't get diagnostics
from the compiler depends really on the compiler.
If you instantiate it, such as add S1<int>::S2 s; at the end, you get it
properly diagnosed even with g++.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/97446] gcc accepts an unnamed struct
2020-10-15 14:19 [Bug c++/97446] New: gcc accepts an unnamed struct tangyixuan at mail dot dlut.edu.cn
2020-10-15 14:23 ` [Bug c++/97446] " jakub at gcc dot gnu.org
@ 2020-10-15 14:46 ` redi at gcc dot gnu.org
2020-10-26 16:53 ` mpolacek at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2020-10-15 14:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97446
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Just like PR 97401.
Please try to remember that diagnostics are not required for errors in
uninstantiated templates, so it's not a bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/97446] gcc accepts an unnamed struct
2020-10-15 14:19 [Bug c++/97446] New: gcc accepts an unnamed struct tangyixuan at mail dot dlut.edu.cn
2020-10-15 14:23 ` [Bug c++/97446] " jakub at gcc dot gnu.org
2020-10-15 14:46 ` redi at gcc dot gnu.org
@ 2020-10-26 16:53 ` mpolacek at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-26 16:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97446
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Closing.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-10-26 16:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15 14:19 [Bug c++/97446] New: gcc accepts an unnamed struct tangyixuan at mail dot dlut.edu.cn
2020-10-15 14:23 ` [Bug c++/97446] " jakub at gcc dot gnu.org
2020-10-15 14:46 ` redi at gcc dot gnu.org
2020-10-26 16:53 ` mpolacek 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).