public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96478] New: GCC accepts enum definition in alignas()
@ 2020-08-05 4:41 haoxintu at gmail dot com
2020-08-05 12:28 ` [Bug c++/96478] " mpolacek at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: haoxintu at gmail dot com @ 2020-08-05 4:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96478
Bug ID: 96478
Summary: GCC accepts enum definition in alignas()
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: haoxintu at gmail dot com
Target Milestone: ---
Hi, all.
This code might be a invalid code, but GCC accepts it well. Other mainstream
compilers reject this code.
Code:
namespace {
template <class> int foo(){return 0;}
template <>
alignas (enum e{}) int foo<int>();
}
Output in Clang:
error: '(anonymous namespace)::e' cannot be defined in a type specifier
Output in ICC:
error: type definition is not allowed
Every version from GCC-6.1 onwards behaves the same.
Thanks,
Haoxin
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/96478] GCC accepts enum definition in alignas()
2020-08-05 4:41 [Bug c++/96478] New: GCC accepts enum definition in alignas() haoxintu at gmail dot com
@ 2020-08-05 12:28 ` mpolacek at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-08-05 12:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96478
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
CC| |mpolacek at gcc dot gnu.org
Status|UNCONFIRMED |NEW
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=95935
Last reconfirmed| |2020-08-05
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Related to 95935.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-05 12:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-05 4:41 [Bug c++/96478] New: GCC accepts enum definition in alignas() haoxintu at gmail dot com
2020-08-05 12:28 ` [Bug c++/96478] " 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).