Where specifically is this covered in the Standard? I found §9.2/10: Non-static (9.4) data members shall not have incomplete types. In particular, a class C shall not contain a non-static member of class C, but it can contain a pointer or reference to an object of class C.
, but this doesn't seem to directly support the issue at hand.
#include <iostream>
struct A{
int i;
static A a;
};
A A::a{10};
int main() {
std::cout << A::a.i << '\n';
}
C++11 9.4.2/2:
The declaration of a static data member in its class definition is not a definition and may be of an incomplete type other than cv-qualified
void
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With