catch2/tests/SelfTest/UsageTests
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
..
Approx.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
BDD.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
Benchmark.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
Class.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
Compilation.tests.cpp Move SFINAE in decomposer into return type 2022-12-09 00:40:01 +01:00
Condition.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
Decomposition.tests.cpp Add test for comparing pointers to NULL with != 2022-11-04 19:24:39 +01:00
EnumToString.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
Exception.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
Generators.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
Matchers.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
MatchersRanges.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
Message.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
Misc.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
ToStringByte.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
ToStringChrono.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
ToStringGeneral.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
ToStringOptional.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
ToStringPair.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
ToStringTuple.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
ToStringVariant.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
ToStringVector.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
ToStringWhich.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
Tricky.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00
VariadicMacros.tests.cpp Fix references to license file 2022-10-28 11:30:15 +02:00