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

            Bug ID: 115821
           Summary: -Wc++-compat should warn about anonymous struct
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: diagnostic, documentation
          Severity: enhancement
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

The documentation for -Wc++-compat says:
Warn about ISO C constructs that are outside of the common subset of ISO C and
ISO C++, e.g. request for implicit conversion from void * to a pointer to
non-void type.


Which makes me think that it should warn about anonymous structs (which is
valid for ISO C but not for ISO C++).

Either we should refine the documentation for -Wc++-compat to talk about GNU
extensions in both (well it is part of C11) or warn in this case.

testcase:
```
struct foo{
   struct{
        const int i;
    };
};

```

I don't have a preference on which way this should be fixed though.

Note we might want to warn on qualifiers on anonymous unions in a similar
fashion (see PR 115820) unless we change the documentation to talk about GNU
extensions here.

Reply via email to