diff --git a/src/base/convert_to.h b/src/base/convert_to.h index 83d036043..89d4a85db 100644 --- a/src/base/convert_to.h +++ b/src/base/convert_to.h @@ -18,11 +18,7 @@ namespace base { // Undefined convertion template To convert_to(const From& from) { - // As this function doesn't return a value, if a specialization is - // not found, a compiler error will be thrown (which means that - // the conversion isn't supported). - - // TODO Use a static_assert(false) + static_assert(false && sizeof(To), "Invalid conversion"); } template<> int convert_to(const std::string& from); diff --git a/src/raster/algofill.cpp b/src/raster/algofill.cpp index 051276200..9fbc4d75f 100644 --- a/src/raster/algofill.cpp +++ b/src/raster/algofill.cpp @@ -93,23 +93,23 @@ static inline bool color_equal_8(color_t c1, color_t c2, int tolerance) template static inline bool color_equal(color_t c1, color_t c2, int tolerance) { - // TODO static_assert(false) + static_assert(false && sizeof(ImageTraits), "Invalid color comparison"); } template<> -static inline bool color_equal(color_t c1, color_t c2, int tolerance) +inline bool color_equal(color_t c1, color_t c2, int tolerance) { return color_equal_32(c1, c2, tolerance); } template<> -static inline bool color_equal(color_t c1, color_t c2, int tolerance) +inline bool color_equal(color_t c1, color_t c2, int tolerance) { return color_equal_16(c1, c2, tolerance); } template<> -static inline bool color_equal(color_t c1, color_t c2, int tolerance) +inline bool color_equal(color_t c1, color_t c2, int tolerance) { return color_equal_8(c1, c2, tolerance); } diff --git a/src/raster/conversion_alleg.cpp b/src/raster/conversion_alleg.cpp index 2c1b411d0..83785f219 100644 --- a/src/raster/conversion_alleg.cpp +++ b/src/raster/conversion_alleg.cpp @@ -38,9 +38,7 @@ namespace { template int convert_color_to_allegro(color_t color, const Palette* palette) { - // Error, it must use a specialization - - // TODO Use a static_assert(false) + static_assert(false && sizeof(ImageTraits), "Invalid color conversion"); } template<> diff --git a/src/raster/conversion_she.cpp b/src/raster/conversion_she.cpp index ce5c5abab..634292524 100644 --- a/src/raster/conversion_she.cpp +++ b/src/raster/conversion_she.cpp @@ -41,9 +41,7 @@ namespace { template uint32_t convert_color_to_surface(color_t color, const Palette* palette, const she::SurfaceFormatData* fd) { - // Error, it must use a specialization - - // TODO Use a static_assert(false) + static_assert(false && sizeof(ImageTraits), "Invalid color conversion"); } template<>