id summary reporter owner description type status milestone component version severity resolution keywords cc 5507 const char vs. const signed char in boost/archive/iterators/binary_from_base64.hpp Gernot Hillier Robert Ramey "There seems to be a small bug in binary_from_base64.hpp: {{{ CharType operator()(CharType t) const{ const char lookup_table[] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, [...] }}} However, it's not guaranteed that a ""const char"" accepts signed values, see e.g. http://www.network-theory.co.uk/docs/gccintro/gccintro_71.html. See also /usr/include/limits.h - depending whether {{{__CHAR_UNSIGNED__}}} is set or not, the platform may not or may accept negative values for a const char. Especially when enabling C++0x support, this leads to a compilation failure e.g. on PowerPC: {{{ ""powerpc-linux-gnu-g++"" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pthread -fPIC -std=c++0x -DBOOST_ALL_NO_LIB=1 -DBOOST_SERIALIZATION_DYN_LINK=1 -DNDEBUG -I""."" -c -o ""bin.v2/libs/serialization/build/gcc-powerpc/release/threading-multi/basic_text_iprimitive.o"" ""libs/serialization/src/basic_text_iprimitive.cpp"" [...] In file included from ./boost/archive/impl/basic_text_iprimitive.ipp:30:0, from libs/serialization/src/basic_text_iprimitive.cpp:19: [...] ./boost/archive/iterators/binary_from_base64.hpp:51:9: error: narrowing conversion of '-0x00000000000000001' from 'int' to 'const char' inside { } }}} The following patch fixed the problem for us: {{{ Index: boost_1_46_1/boost/archive/iterators/binary_from_base64.hpp =================================================================== --- boost_1_46_1.orig/boost/archive/iterators/binary_from_base64.hpp +++ boost_1_46_1/boost/archive/iterators/binary_from_base64.hpp @@ -39,7 +39,7 @@ template struct to_6_bit { typedef CharType result_type; CharType operator()(CharType t) const{ - const char lookup_table[] = { + const signed char lookup_table[] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63, }}}" Bugs closed To Be Determined serialization Boost 1.46.1 Problem fixed