jeudi 2 juin 2016

Warning in list initialization in C++11

This is my code :

int x=65;
char ch{x};

And this is the warning when compiled with `-std=C++11 flag:

Narrowed conversion from "int to char"

But I think there should be an error as x is not a constant and we are initializing ch with a non-constant value. What actually happens?

Aucun commentaire:

Enregistrer un commentaire