You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is meant for tracking the workarounds we have implemented around compiler bugs
MSVC 2015: bug with std::enable_if and invalid types
std::enable_if evaluates its second argument, even if the condition is false. This is the reason for the get_xfunction_type_t workaround which adds a level of indirection for the second type to always be a valid type (Original issue #80, fixed in PR #148).
MSVC 2015: math functions not fully qualified
fma class is ambiguous if not fully qualified. See #81.
GCC-4.9 and clang < 3.8: constexprstd::min and std::max
std::min and std::max are not constexpr in these compiler. In xio.hpp, we define a XTENSOR_MIN macro before its usage and undefine it right after.
clang < 3.8 matching initializer_list with static arrays.
Old versions of clang don't handle overload resolution with braced initializer lists correctly: braced initializer lists are not properly matched to static arrays. This prevent compile-time detection of the length of a braced initializer list.
A consequence is that we need to use stack-allocated shape types in these cases.
GCC-6: std::isnan and std::isinf.
We are not directly using std::isnan or std::isinf in xmath as a workaround to the following bug in GCC-6 for the following reason.
C++11 requires that the <cmath> header declares bool std::isnan(double) and bool std::isinf(double).
C99 requires that the <math.h> header declares int ::isnan(double) and int ::isinf(double).
These two definitions would clash when importing both headers and using namespace std.
As of version 6, gcc detects whether the obsolete functions are present in the C <math.h> header and uses them if they are, avoiding the clash. However, this means that the function might return int instead
of bool as C++11 requires, which is a bug.
The text was updated successfully, but these errors were encountered:
This issue is meant for tracking the workarounds we have implemented around compiler bugs
MSVC 2015: bug with
std::enable_if
and invalid typesstd::enable_if
evaluates its second argument, even if the condition is false. This is the reason for theget_xfunction_type_t
workaround which adds a level of indirection for the second type to always be a valid type (Original issue #80, fixed in PR #148).MSVC 2015: math functions not fully qualified
fma
class is ambiguous if not fully qualified. See #81.GCC-4.9 and clang < 3.8:
constexpr
std::min
andstd::max
std::min
andstd::max
are not constexpr in these compiler. Inxio.hpp
, we define a XTENSOR_MIN macro before its usage and undefine it right after.clang < 3.8 matching
initializer_list
with static arrays.Old versions of clang don't handle overload resolution with braced initializer lists correctly: braced initializer lists are not properly matched to static arrays. This prevent compile-time detection of the length of a braced initializer list.
A consequence is that we need to use stack-allocated shape types in these cases.
GCC-6:
std::isnan
andstd::isinf
.We are not directly using
std::isnan
orstd::isinf
inxmath
as a workaround to the following bug in GCC-6 for the following reason.C++11 requires that the
<cmath>
header declaresbool std::isnan(double)
andbool std::isinf(double)
.C99 requires that the
<math.h>
header declaresint ::isnan(double)
andint ::isinf(double)
.These two definitions would clash when importing both headers and using namespace std.
As of version 6, gcc detects whether the obsolete functions are present in the C
<math.h>
header and uses them if they are, avoiding the clash. However, this means that the function might return int insteadof bool as C++11 requires, which is a bug.
The text was updated successfully, but these errors were encountered: