[cfe-dev] Error when testing clang with VC++ RTL and Boost MPL

Edward Diener eldlistmailingz at tropicsoft.com
Wed Nov 13 06:46:05 PST 2013


I am seeing this error when testing Boost MPL with clang using the VC++ RTL:

"bitwise.cpp(40,25) :  error: non-type template argument evaluates to 
4294967295, which cannot be narrowed to type 'long' [-Wc++11-narrowing]
MPL_ASSERT_RELATION( (bitor_<_0,_ffffffff>::value), ==, 0xffffffff );"

The typedefs are:

typedef integral_c<unsigned int, 0> _0;
typedef integral_c<unsigned int, 0xffffffff> _ffffffff;

The bitor_ in the Boost MPL is evaluating constants at compile time, 
doing a bitwise or ('|').

Why does clang think that 0xffffffff is a 'long' when used in the 
comparison ? According to the C++ standard the type of 0xffffffff is the 
first of int, unsigned int, long, unsigned long, long long, unsigned 
long long in which its value can fit ( section 2.14.2 ). Is this a clang 
bug ?




More information about the cfe-dev mailing list