Problem when compiling with GCC and std=c++0x

ursus_maritimus
Posts: 1
Joined: Fri Jan 06, 2012 6:06 pm

Problem when compiling with GCC and std=c++0x

Post by ursus_maritimus »

As the title says, I get an error when compiling bullet physics as a sub-project of my own while including C++11 support. Specifically, I get a huge amount of "narrowing conversion of ‘-0x00000000000000080’ from ‘int’ to ‘unsigned char’ inside { } [-fpermissive]" errors in btSerializer.cpp.

Searching around, I couldn't find anyone with the same problem. Obviously it seems related to the fact that there are negative numbers in the arrays, and a simple test of my own confirmed that. The same error does not appear if assigning a negative number to an element of an unsigned int[]. Further more, the error does not occur if assigning a regular (non-array) unsigned char a negative number. That is,

Code: Select all

unsigned char c = -10;
does not generate an error, but

Code: Select all

unsigned char c[] = {-10, 10};
does.

Might this be a bug in GCC? Would it work to (temporarily) solve the issue for myself by wrapping the negative numbers in a static_cast<unsigned char>()?

Various pieces of technical information:
OS: 64-bit debian based linux distro
Compiler: GCC/g++ 4.6.1
Bullet version: 2.79