mirror of https://github.com/CGAL/cgal
| ------------------------------------------------------------------------
| r57003 | afabri | 2010-06-23 10:30:32 +0200 (Wed, 23 Jun 2010) | 1 line
|
| int -> size_t and static_casts
| ------------------------------------------------------------------------
The conversion from int to size_t is not always safe. Here the right type
was a signed type: std::ptrdiff_t, especially because the variable stores a
difference between two pointers.
The bug was discovered by a very recent version of clang:
clang version 3.2 (trunk 160721)
The error was:
cd /home/lrineau/CGAL/CGAL-4.1-Ic-113/cmake/platforms/x86-64_Linux-2.6_llvm-clang-with-g++-4.6.2_F16/src/CGAL && /usr/local/packages/llvm-trunk/bin/clang++ -DCGAL_EXPORTS -DCGAL_TEST_SUITE -DCGAL_USE_MPFR -DCGAL_USE_GMPXX -DCGAL_USE_GMP --std=c++11 -fno-strict-aliasing -Wall -fPIC -I/home/lrineau/CGAL/CGAL-4.1-Ic-113/cmake/platforms/x86-64_Linux-2.6_llvm-clang-with-g++-4.6.2_F16/include -I/home/lrineau/CGAL/CGAL-4.1-Ic-113/include -I/home/lrineau/CGAL/boost/boost-release-branch -o CMakeFiles/CGAL.dir/all_files.cpp.o -c /home/lrineau/CGAL/CGAL-4.1-Ic-113/cmake/platforms/x86-64_Linux-2.6_llvm-clang-with-g++-4.6.2_F16/src/CGAL/all_files.cpp
In file included from /home/lrineau/CGAL/CGAL-4.1-Ic-113/cmake/platforms/x86-64_Linux-2.6_llvm-clang-with-g++-4.6.2_F16/src/CGAL/all_files.cpp:2:
/home/lrineau/CGAL/CGAL-4.1-Ic-113/src/CGAL/JAMA_numeric_solver.cpp:83:14: error: case value evaluates to -1, which cannot be narrowed to type 'std::size_t' (aka 'unsigned long') [-Wc++11-narrowing]
case -1:
^
/home/lrineau/CGAL/CGAL-4.1-Ic-113/src/CGAL/JAMA_numeric_solver.cpp:109:14: error: case value evaluates to -1, which cannot be narrowed to type 'std::size_t' (aka 'unsigned long') [-Wc++11-narrowing]
case -1:
^
In file included from /home/lrineau/CGAL/CGAL-4.1-Ic-113/cmake/platforms/x86-64_Linux-2.6_llvm-clang-with-g++-4.6.2_F16/src/CGAL/all_files.cpp:13:
/home/lrineau/CGAL/CGAL-4.1-Ic-113/src/CGAL/Turkowski_numeric_solver.cpp:398:8: error: case value evaluates to -1, which cannot be narrowed to type 'std::size_t' (aka 'unsigned long') [-Wc++11-narrowing]
case -1:
^
/home/lrineau/CGAL/CGAL-4.1-Ic-113/src/CGAL/Turkowski_numeric_solver.cpp:431:8: error: case value evaluates to -1, which cannot be narrowed to type 'std::size_t' (aka 'unsigned long') [-Wc++11-narrowing]
case -1:
^
4 errors generated.
|
||
|---|---|---|
| .. | ||
| demo/Kinetic_data_structures | ||
| doc_tex | ||
| examples | ||
| hidden | ||
| include/CGAL | ||
| package_info/Kinetic_data_structures | ||
| src | ||
| test | ||
| dont_submit | ||
| todo | ||