https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124301
Bug ID: 124301
Summary: GCC fails to diagnose invalid use of inline on
anonymous union member
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mingdeng7254 at gmail dot com
Target Milestone: ---
GCC accepts the following C++ code without any diagnostic, while Clang
correctly rejects it:
```cpp
struct S {
typedef struct {} U;
inline union { int x; };
};
void foo() {
struct S s;
}
```
According to C++ std (https://eel.is/c++draft/dcl.inline#1), the `inline`
specifier is not permitted in this context.
A Godbolt link is here: https://godbolt.org/z/5oWMz14Kx