When I try to compile this code
struct T
{
unsigned char x;
};
int main()
{
unsigned char a = 10;
unsigned char b = 1;
T t = {a + b};
return 0;
}
I get this error:
error: narrowing conversion of '(((int)a) + ((int)b))' from 'int' to 'unsigned char' inside { } [-Wnarrowing]|
Can anyone explain me why?