Consider the following code:
// E1 << E2 with E1 bool, and E2 an integer
true << static_cast<char>(1);
true << static_cast<short int>(1);
true << static_cast<int>(1);
true << static_cast<unsigned int>(1);
true << static_cast<long long int>(1);
true << static_cast<long long unsigned int>(1);
When doing the operation, is E1
promoted as the same type as E2
, or is it promoted first to int
and then to std::common_type<E1, E2>::type
?
In other words, is:
true << static_cast<char>(9);
defined, or undefined behaviour ?