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
This commit is contained in:
Jesse Yurkovich
2024-08-14 19:52:48 +02:00
committed by Jesse Yurkovich
parent e7787f24aa
commit 92d935a205

View File

@@ -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. */