#9517 closed Bugs (fixed)
boost gil compile error because of type narrowing
Reported by: | Owned by: | Mateusz Loskot | |
---|---|---|---|
Milestone: | Boost 1.68.0 | Component: | gil USE GITHUB |
Version: | Boost 1.54.0 | Severity: | Problem |
Keywords: | Cc: | william@…, mateusz@… |
Description
line 204 in boost/gil/channel_algorithm.hpp if (src > unsigned_integral_max_value<uintmax_t>::value - div2) gives me this error with clang error: non-type template argument
evaluates to -1, which cannot be narrowed to type 'unsigned long' [-Wc++11-narrowing]
struct unsigned_integral_max_value : public mpl::integral_c<UnsignedIntegralChannel,-1> {};
can you just replace with std::numeric_limits<unitmax_t>::max()?
Attachments (1)
Change History (11)
comment:1 by , 8 years ago
Cc: | added |
---|
comment:2 by , 8 years ago
… incidentally, I went for a std:: numeric_limits <UnsignedIntegralChannel>:: max () instead … not sure which is more correct in this context.
comment:3 by , 7 years ago
I am facing the same problem in the same file, with Boost 1.57, on line 54. Does someone knows the status of this ?
comment:4 by , 6 years ago
Cc: | added |
---|
comment:5 by , 5 years ago
This is easy to to fix. integral_c is defined by: template< typename T, T N > struct integral_c;
So the 2nd template parameter is of type T=UnsignedIntegralChannel.
Therefore, -1 can easily be replaced by either std::numeric_limits<UnsignedIntegralChannel>::max() or static_cast<UnsignedIntegralChannel>(-1)
See patch attached.
comment:6 by , 5 years ago
Owner: | changed from | to
---|
comment:7 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:8 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Duplicate of #7270 (already fixed)
comment:9 by , 5 years ago
Version: | Boost 1.54.0 → Boost Development Trunk |
---|
comment:10 by , 5 years ago
Milestone: | To Be Determined → Boost 1.68.0 |
---|---|
Version: | Boost Development Trunk → Boost 1.54.0 |
This error persists in Boost 1.55 using clang of Xcode 5.1 on Mac OS 10.9 (Don't see how to select multiple values for the version field here!)