catch2/tests/SelfTest
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
..
Baselines Add version field to the XML reporter output 2022-11-10 12:04:51 +01:00
IntrospectiveTests Decomposer checks for 0 when assuming an int arg was 0 literal 2022-11-05 20:43:52 +01:00
Misc Move tests from projects/ to tests/ 2019-12-05 16:00:20 +01:00
TimingTests Fix references to license file 2022-10-28 11:30:15 +02:00
UsageTests Move SFINAE in decomposer into return type 2022-12-09 00:40:01 +01:00
helpers Support decomposing types that only compare with literal 0 2022-11-04 19:24:44 +01:00
TestRegistrations.cpp Fix references to license file 2022-10-28 11:30:15 +02:00