I thought braced initialization doesn't allow narrowing. But why is int const allowed for char braced initialization?
int value1 = 12;
char c1{value1}; // error! no narrowing
const int value2 = 12;
char c2{value2}; // why is this fine?
See it on godbolt.
Aucun commentaire:
Enregistrer un commentaire