When I compile <bitset> is compiled with warnings enabled, I get the
following error (which is interesting in itself, it should only be a
warning):
/usr/include/c++/v1/bitset:265:16: error: non-constant-expression cannot be narrowed from type 'unsigned long long' to '__storage_type' (aka 'unsigned int') in
initializer list [-Wc++11-narrowing]
: __first_{__v, __v >> __bits_per_word}
^~~
/usr/include/c++/v1/bitset:676:52: note: in instantiation of member function 'std::__1::__bitset<2, 53>::__bitset' requested here
bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
^
/home/dim/src/llvm/trunk/include/llvm/IR/Attributes.h:455:9: note: in instantiation of member function 'std::__1::bitset<53>::bitset' requested here
: Attrs(0), Alignment(0), StackAlignment(0), DerefBytes(0),
^
/usr/include/c++/v1/bitset:265:16: note: insert an explicit cast to silence this issue
: __first_{__v, __v >> __bits_per_word}
^~~Note that this is on i386, so this uses the #elif part of the
__bitset constructor:
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
#if __SIZEOF_SIZE_T__ == 8
: __first_{__v}
#elif __SIZEOF_SIZE_T__ == 4
: __first_{__v, __v >> __bits_per_word}
#else
#error This constructor has not been ported to this platform
#endif
#endifIndeed, __first_ has type __storage_type, which is 32 bits on this
platform, so I think an explicit static_cast is required here.