Consider the code:
struct Foo
{
int x = 10;
};
int main()
{
const Foo foo;
}
It compiles under g++ http://coliru.stacked-crooked.com/a/99bd8006e10b47ef, however spits an error under clang++ http://coliru.stacked-crooked.com/a/93f94f7d9625b579 :
error: default initialization of an object of const type
'const Foo' requires a user-provided default constructor
I am not sure who's right here. Why do we need a default ctor since we perform in-class initialization?