When I run this code:

struct X {
    int a;
};

struct Y : public X {};

X x = {0};
Y Y = {0};

I get:

error: could not convert ‘{0}’ from ‘<brace-enclosed initializer list>’ to ‘Y’

Why does brace initialization work for the base class but not the derived class?

Edit
Report