I have the following code:
struct Foo
{
struct Bar
{
std::uint32_t x = -1;
constexpr Bar(std::uint32_t x) : x(x) {}
};
static constexpr Bar CONST_BAR = Bar(0);
};
When I try to compile it I get the following error:
error: ‘constexpr Foo::Bar::Bar(uint32_t)’ called in a constant expression before its definition is complete
Can someone explain to me what is going on? As far as I can see Bar's constructor is defined before the first call.