AcademySoftwareFoundation / Imath

Imath is a C++ and python library of 2D and 3D vector, matrix, and math operations for computer graphics
https://imath.readthedocs.io
BSD 3-Clause "New" or "Revised" License
376 stars 112 forks source link

ImathTest does not build with Apple Clang C++ 20 #297

Open jakobrieke opened 1 year ago

jakobrieke commented 1 year ago

Apple Clang does not support std::bit_cast() which is used in src/ImathTest/testFun.cpp (https://en.cppreference.com/w/cpp/compiler_support), using Imath 3.1.6. The problem could be resolved by using the already defined polyfill in the same file for Apple Clang.

So line 23 in src/ImathTest/testFun.cpp:

#if __cplusplus < 202002L

could become something like:

#if __cplusplus < 202002L || (__clang__ && __APPLE__)

Also line 11 in the same file could be changed to:

#if __cplusplus >= 202002L && !(__clang__ && __APPLE__)

since including is then no longer required.

TobiSchluter commented 1 year ago

This also fails on Android. Probably the correct check is for __cpp_lib_bit_cast as this is not specific to Apple.

TobiSchluter commented 1 year ago

ps like this https://github.com/AcademySoftwareFoundation/Imath/pull/346