This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/67006] New: type-specifier const in declaration of anonymous union
- From: "anders.granlund.0 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 25 Jul 2015 14:29:38 +0000
- Subject: [Bug c++/67006] New: type-specifier const in declaration of anonymous union
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67006
Bug ID: 67006
Summary: type-specifier const in declaration of anonymous union
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 program (prog.cc):
const union {};
int main() {}
It is ill-formed by [dcl.type.cv] http://eel.is/c++draft/dcl.dcl#dcl.type.cv-1:
"If a cv-qualifier appears in a decl-specifier-seq, the init-declarator-list of
the declaration shall not be empty."
Compile the program with the following command line:
g++ prog.cc -std=c++14 -pedantic-errors
No error messages are given. I expected to get an error message here since the
program is ill-formed.
I tried this with gcc HEAD 6.0.0 201507, here:
http://melpon.org/wandbox/permlink/lGKyEQQW4BtKube9