public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97475] New: An unnamed class with a typedef name for linkage purposes having a method.
@ 2020-10-17 21:48 anders.granlund.0 at gmail dot com
2021-08-04 11:20 ` [Bug c++/97475] " redi at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: anders.granlund.0 at gmail dot com @ 2020-10-17 21:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97475
Bug ID: 97475
Summary: An unnamed class with a typedef name for linkage
purposes having a method.
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: anders.granlund.0 at gmail dot com
Target Milestone: ---
Consider the following c++ program:
typedef struct {
void f();
} X;
int main()
{
}
It is not rejected by the compiler when compiling with "-std=c++20
-pedantic-errors".
The expected behaviour is that it should be rejected by section 9.2.3 paragraph
10 in the c++ 20 standard:
"
10 An unnamed class with a typedef name for linkage purposes shall not
(10.1) — declare any members other than non-static data members, member
enumerations, or member classes,
(10.2) — have any base classes or default member initializers, or
(10.3) — contain a lambda-expression,
and all member classes shall also satisfy these requirements (recursively).
"
Note that clang correctly does reject the program:
https://godbolt.org/z/rTerza
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/97475] An unnamed class with a typedef name for linkage purposes having a method.
2020-10-17 21:48 [Bug c++/97475] New: An unnamed class with a typedef name for linkage purposes having a method anders.granlund.0 at gmail dot com
@ 2021-08-04 11:20 ` redi at gcc dot gnu.org
2021-08-04 21:43 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-04 11:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97475
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-08-04
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/97475] An unnamed class with a typedef name for linkage purposes having a method.
2020-10-17 21:48 [Bug c++/97475] New: An unnamed class with a typedef name for linkage purposes having a method anders.granlund.0 at gmail dot com
2021-08-04 11:20 ` [Bug c++/97475] " redi at gcc dot gnu.org
@ 2021-08-04 21:43 ` pinskia at gcc dot gnu.org
2021-08-05 11:32 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-04 21:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97475
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Depends on| |46589
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think this is a dup of bug 46589.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46589
[Bug 46589] struct member function not declared global
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/97475] An unnamed class with a typedef name for linkage purposes having a method.
2020-10-17 21:48 [Bug c++/97475] New: An unnamed class with a typedef name for linkage purposes having a method anders.granlund.0 at gmail dot com
2021-08-04 11:20 ` [Bug c++/97475] " redi at gcc dot gnu.org
2021-08-04 21:43 ` pinskia at gcc dot gnu.org
@ 2021-08-05 11:32 ` redi at gcc dot gnu.org
2021-08-05 11:35 ` redi at gcc dot gnu.org
2021-08-05 13:34 ` anders.granlund.0 at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-05 11:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97475
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Well that's about the linkage of such entities, this is about whether they are
ill-formed.
The rule that makes this ill-formed was added by https://wg21.link/p1766r1 but
was approved as a defect report against previous standards.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/97475] An unnamed class with a typedef name for linkage purposes having a method.
2020-10-17 21:48 [Bug c++/97475] New: An unnamed class with a typedef name for linkage purposes having a method anders.granlund.0 at gmail dot com
` (2 preceding siblings ...)
2021-08-05 11:32 ` redi at gcc dot gnu.org
@ 2021-08-05 11:35 ` redi at gcc dot gnu.org
2021-08-05 13:34 ` anders.granlund.0 at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-05 11:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97475
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Maybe we should make this ill-formed for C++20, and a pedwarn otherwise, so
existing code continues to compile using previous standards.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/97475] An unnamed class with a typedef name for linkage purposes having a method.
2020-10-17 21:48 [Bug c++/97475] New: An unnamed class with a typedef name for linkage purposes having a method anders.granlund.0 at gmail dot com
` (3 preceding siblings ...)
2021-08-05 11:35 ` redi at gcc dot gnu.org
@ 2021-08-05 13:34 ` anders.granlund.0 at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: anders.granlund.0 at gmail dot com @ 2021-08-05 13:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97475
--- Comment #4 from Anders Granlund <anders.granlund.0 at gmail dot com> ---
Sounds good to me!
On Thu, 5 Aug 2021, 13:35 redi at gcc dot gnu.org, <gcc-bugzilla@gcc.gnu.org>
wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97475
>
> --- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> Maybe we should make this ill-formed for C++20, and a pedwarn otherwise, so
> existing code continues to compile using previous standards.
>
> --
> You are receiving this mail because:
> You reported the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-08-05 13:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-17 21:48 [Bug c++/97475] New: An unnamed class with a typedef name for linkage purposes having a method anders.granlund.0 at gmail dot com
2021-08-04 11:20 ` [Bug c++/97475] " redi at gcc dot gnu.org
2021-08-04 21:43 ` pinskia at gcc dot gnu.org
2021-08-05 11:32 ` redi at gcc dot gnu.org
2021-08-05 11:35 ` redi at gcc dot gnu.org
2021-08-05 13:34 ` anders.granlund.0 at gmail dot com
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).