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

Reply via email to