Consider the code:
struct Foo
{
int x = 10;
};
int main()
{
const Foo foo;
}
It compiles under g++ http://ift.tt/1w9NTwv, however spits an error under clang++ http://ift.tt/1xz7Un4 :
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?
Aucun commentaire:
Enregistrer un commentaire