https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114067
Bug ID: 114067
Summary: GCC gives wrong diagnostic in the definition of a
static data member of same class type
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jlame646 at gmail dot com
Target Milestone: ---
The following program produces wrong diagnostic with gcc and clang:
```
struct A{
int x;
static const A a{1};
};
```
GCC says `in-class initialization of static data member 'const A A::a' of
incomplete type`.
While the actual problem is not that `A` is incomplete but that it is not an
integral or enumeration type.
Only msvc gives correct diagnostic saying:
```
error C2864: 'A::a': a static data member with an in-class initializer must
have non-volatile const integral type or be specified as 'inline'
```
So I think gcc should say something similar to msvc instead of saying that `A`
being incomplete is the problem.