I have a code that works fine in Visual Studio:
struct A
{
struct P{ P() = default; int x = 1; };
void foo( const P & = {} );
};
However both gcc and clang refuse to compile it with the error:
<source>:4:28: error: default member initializer for 'A::P::x' required before the end of its enclosing class
4 | void foo( const P & = {} );
https://gcc.godbolt.org/z/ja3c9zPMY
Could you please suggest what is wrong with the code?