Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/fuzzing
diff options
context:
space:
mode:
authorMartin Hořeňovský2024-02-08 22:21:18 +0100
committerMartin Hořeňovský2024-02-12 00:52:53 +0100
commitdc51386b9fd61f99ea9c660d01867e6ad489b403 (patch)
tree1913dcd78aa8cf81e9620f1339dd707d015725dc /fuzzing
parentbbba3d8a068aeb5ec677db30947fe97fe047a2ba (diff)
downloadcatch3-dc51386b9fd61f99ea9c660d01867e6ad489b403.tar.gz
Support literal-zero detectors using consteval int constructors
This was originally motivated by `REQUIRE((a <=> b) == 0)` no longer compiling using MSVC. After some investigation, I found that they changed their implementation of the zero literal detector from the previous pointer-constructor with deleted other constructors, into one that uses `consteval` constructor from int. This breaks the previous detection logic, because now `is_foo_comparable<std::strong_ordering, int>` is true, but actually trying to compare them is a compile-time error... The solution was to make the decomposition `constexpr` and rely on a late C++20 DR that makes it so that `consteval` propagates up through the callstack of `constexpr` functions, until it either runs out of `constexpr` functions, or succeeds. However, the default handling of types in decomposition is to take a reference to them. This reference never becomes dangling, but because the constexpr evaluation engine cannot prove this, decomposition paths taking references to objects cannot be actually evaluated at compilation time. Thankfully we already did have a value-oriented decomposition path for arithmetic types (as these are common linkage-less types), so we could just explicitly spell out the `std::foo_ordering` types as also being supposed to be decomposed by-value. Two more fun facts about these changes 1) The original motivation of the MSVC change was to avoid trigering a `Wzero-as-null-pointer-constant` warning. I still do not believe this was a good decision. 2) Current latest version of MSVC does not actually implement the aforementioned C++20 DR, so even with this commit, MSVC cannot compile `REQUIRE((a <=> b) == 0)`.
Diffstat (limited to 'fuzzing')
0 files changed, 0 insertions, 0 deletions