From 9db45d84728132c5a78d85d3884b0abcbc12dc14 Mon Sep 17 00:00:00 2001 From: Jesse Yurkovich Date: Wed, 14 Aug 2024 19:52:48 +0200 Subject: [PATCH] Build: Ambiguous call to isfinite for MSVC 17.11 Overload resolution must have changed and is causing issues for one particular code path attempting to use `isfinite(ccl::uchar)`. Compiler output attached. It turns out that the code in question can be simplified to just remove the ambiguity because only the float codepath wants to check for finite values. ---- Reduced repro: https://godbolt.org/z/YWz3Yc3x8 Pull Request: https://projects.blender.org/blender/blender/pulls/125348 --- intern/cycles/scene/image.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/intern/cycles/scene/image.cpp b/intern/cycles/scene/image.cpp index 38dbdff8e3e..1f4d129950d 100644 --- a/intern/cycles/scene/image.cpp +++ b/intern/cycles/scene/image.cpp @@ -28,20 +28,6 @@ CCL_NAMESPACE_BEGIN namespace { -/* Some helpers to silence warning in templated function. */ -bool isfinite(uchar /*value*/) -{ - return true; -} -bool isfinite(half /*value*/) -{ - return true; -} -bool isfinite(uint16_t /*value*/) -{ - return true; -} - const char *name_from_type(ImageDataType type) { switch (type) { @@ -628,7 +614,7 @@ bool ImageManager::file_load_image(Image *img, int texture_limit) } /* Make sure we don't have buggy values. */ - if (FileFormat == TypeDesc::FLOAT) { + if constexpr (FileFormat == TypeDesc::FLOAT) { /* For RGBA buffers we put all channels to 0 if either of them is not * finite. This way we avoid possible artifacts caused by fully changed * hue. */