I ran into this breaking change when I used GCC. The compiler printed an error for code like this:
void foo(const unsigned long long &i)
{
unsigned int a[2] = {i & 0xFFFFFFFF, i >> 32};
}
In function
void foo(const long long unsigned int&)
:error: narrowing conversion of
(((long long unsigned int)i) & 4294967295ull)
fromlong long unsigned int
tounsigned int
inside { }error: narrowing conversion of
(((long long unsigned int)i) >> 32)
fromlong long unsigned int
tounsigned int
inside { }
Fortunately, the error messages were straightforward and the fix was simple:
void foo(const unsigned long long &i)
{
unsigned int a[2] = {static_cast<unsigned int>(i & 0xFFFFFFFF),
static_cast<unsigned int>(i >> 32)};
}
The code was in an external library, with only two occurrences in one file. I don’t think the breaking change will affect much code. Novices might get confused, though.