The Vec2, Vec3, and Vec4 classes declare methods length(), normalize(), normalizeExc(), normalizeNonNull(), normalized(),
normalizedExc(), and normalizedNonNull(), which are invalid for integer types.
The pre-existing declarations remove the integer instantiations via =delete:
template <>
IMATH_HOSTDEVICE short Vec2<short>::length () const IMATH_NOEXCEPT = delete;
but this appears to not work with Clang20 (at least on msys2, as reported in AcademySoftwareFoundation/openexr#2101). The template appears to get instantiated before the =delete, which
causes an error. I tried moving the =delete to just after the class declaration, but that doesn't appear to resolve the problem.
The better solution is to replace the =delete with SFINAE (Substitution Failure is Not an Error):
template <typename U=T, typename = std::enable_if_t<std::is_floating_point_v<U>>>
IMATH_HOSTDEVICE T length () const IMATH_NOEXCEPT;
With this form, the declaration is excluded entirely if the condition fails (i.e. if T is not a floating-point type). Unlike =delete, which
makes the function ill-formed if called, SFINAE makes the function invisible to the compiler when the condition is not satisfied.
The Vec2, Vec3, and Vec4 classes declare methods length(), normalize(), normalizeExc(), normalizeNonNull(), normalized(),
normalizedExc(), and normalizedNonNull(), which are invalid for integer types.
The pre-existing declarations remove the integer instantiations via
=delete:but this appears to not work with Clang20 (at least on msys2, as reported in AcademySoftwareFoundation/openexr#2101). The template appears to get instantiated before the
=delete, whichcauses an error. I tried moving the
=deleteto just after the class declaration, but that doesn't appear to resolve the problem.The better solution is to replace the
=deletewith SFINAE (Substitution Failure is Not an Error):With this form, the declaration is excluded entirely if the condition fails (i.e. if T is not a floating-point type). Unlike
=delete, whichmakes the function ill-formed if called, SFINAE makes the function invisible to the compiler when the condition is not satisfied.