catch2/tests
Martin Hořeňovský 28e651f152
Move SFINAE in decomposer into return type
This is needed so that we can use conjunction and other logical
type traits to workaround issue with older GCC versions (8 and
below), when they run into types that have ambiguous constructor
from `0`, see e.g. #2571.

However, using conjunction and friends in the SFINAE constraint
in the template parameter breaks for C++20 and up, due to the new
comparison operator rewriting rules. With C++20, when the compiler
see `a == b`, it also tries `b == a` and collects overload set
for both of these expressions.

In Catch2, this means that e.g. `REQUIRE( 1 == 2 )` would lead
the compiler to check overloads for both `ExprLhs<int> == int`
and `int == ExprLhs<int>`. Since the overload set and SFINAE
constraints assume that `ExprLhs<T>` is always on the left side,
when the compiler tries to resolve the template parameters, all
hell breaks loose and the compilation fails.

By moving the SFINAE constraints to the return type, the compiler
can discard the switched expression without having to resolve
the complex SFINAE constraints, and thus everything works the
way it is supposed to.

Fixes #2571
2022-12-09 00:40:01 +01:00
..
ExtraTests Update basic cost estimates for approvals/benchmarks 2022-11-06 21:23:03 +01:00
SelfTest Move SFINAE in decomposer into return type 2022-12-09 00:40:01 +01:00
TestScripts Fix references to license file 2022-10-28 11:30:15 +02:00
CMakeLists.txt Update basic cost estimates for approvals/benchmarks 2022-11-06 21:23:03 +01:00
meson.build Add traits for checking whether types are comparable 2022-11-04 19:24:42 +01:00