Can someone point me please, to a corresponding paragraph of the C++ standard, or maybe can provide some explanation why my code does not compile if I uncomment the text ({123})?
Generally speaking I understand what something wrong with usage of default member initialization and initialization via initializer list, but I can't refer to exact reasons.
enum class MY: int
{
A = 1
};
struct abc
{
int a;/*{123};*/ //compilation failed if uncommented
MY m;
};
abc a = {1, MY::A};
Compiler error, in case of uncommented text:
error: could not convert ‘{1, A}’ from ‘<brace-enclosed initializer list>’ to ‘abc’
Aucun commentaire:
Enregistrer un commentaire