https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115820

            Bug ID: 115820
           Summary: Qualified anonymous union is not diagnosed
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: luigighiron at gmail dot com
  Target Milestone: ---

The following code is not diagnosed in GCC:

struct foo{
    const union{
        const int i;
    };
};

This is not a valid anonymous union because the declaration does not follow the
form "union { member-specification } ;" as the C++ standard specifies. This
also generates an error with Clang, though not with MSVC which has the same
bug. Volatile qualification has the same issue as const qualification as
present in the example.

Reply via email to