harrison-lucas / bullet

Automatically exported from code.google.com/p/bullet
Other
0 stars 0 forks source link

Build error: btSoftBodyHelpers.cpp + clang3.2: -Wc++11-narrowing #736

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Building bullet-2.81-rev2613.tgz on travis-ci.org (debian based Linux) using 
clang++ --std=c++11

What is the expected output? What do you see instead?
bullet sdk builds.

Instead I get the following:

1217 
/home/travis/build/JodiTheTigger/game-in-a-box/third-party/bullet-2.x/src/Bullet
SoftBody/btSoftBodyHelpers.cpp:914:21: error: 
1218      non-constant-expression cannot be narrowed from type 'unsigned int' to
1219      'int' in initializer list [-Wc++11-narrowing]
1220                const int idx[]={       hres.m_Indices[i*3+0],
1221                                        ^~~~~~~~~~~~~~~~~~~~~
1222/home/travis/build/JodiTheTigger/game-in-a-box/third-party/bullet-2.x/src/Bu
lletSoftBody/btSoftBodyHelpers.cpp:914:21: note: 
1223      override this message by inserting an explicit cast
1224                const int idx[]={       hres.m_Indices[i*3+0],
1225                                        ^~~~~~~~~~~~~~~~~~~~~
1226                                        static_cast<int>(    )
1227/home/travis/build/JodiTheTigger/game-in-a-box/third-party/bullet-2.x/src/Bu
lletSoftBody/btSoftBodyHelpers.cpp:915:4: error: 
1228      non-constant-expression cannot be narrowed from type 'unsigned int' to
1229      'int' in initializer list [-Wc++11-narrowing]
1230                        hres.m_Indices[i*3+1],
1231                        ^~~~~~~~~~~~~~~~~~~~~
1232/home/travis/build/JodiTheTigger/game-in-a-box/third-party/bullet-2.x/src/Bu
lletSoftBody/btSoftBodyHelpers.cpp:915:4: note: 
1233      override this message by inserting an explicit cast
1234                        hres.m_Indices[i*3+1],
1235                        ^~~~~~~~~~~~~~~~~~~~~
1236                        static_cast<int>(    )
1237/home/travis/build/JodiTheTigger/game-in-a-box/third-party/bullet-2.x/src/Bu
lletSoftBody/btSoftBodyHelpers.cpp:916:4: error: 
1238      non-constant-expression cannot be narrowed from type 'unsigned int' to
1239      'int' in initializer list [-Wc++11-narrowing]
1240                        hres.m_Indices[i*3+2]};
1241                        ^~~~~~~~~~~~~~~~~~~~~
1242/home/travis/build/JodiTheTigger/game-in-a-box/third-party/bullet-2.x/src/Bu
lletSoftBody/btSoftBodyHelpers.cpp:916:4: note: 
1243      override this message by inserting an explicit cast
1244                        hres.m_Indices[i*3+2]};
1245                        ^~~~~~~~~~~~~~~~~~~~~
1246                        static_cast<int>(    )
12473 errors generated.

Please provide any additional information below.
As given by clang, the fix is easy. Just wrap the values in a 
static_cast<int>() (patch file provided).

Original issue reported on code.google.com by jodi.the...@gmail.com on 28 Aug 2013 at 9:18

Attachments:

GoogleCodeExporter commented 9 years ago
thanks for the patch, applied here:
https://code.google.com/p/bullet/source/detail?r=2653

Original comment by erwin.coumans on 10 Sep 2013 at 8:06