GitNexus/gitnexus/test/fixtures/lang-resolution/cpp-sfinae-unknown-predicate/main.cpp
Zander Raycraft a4dfebd073
feat(cpp): sfinae filter (#1623)
* feat(cpp): SFINAE-aware overload filter — drops candidates whose enable_if_t / requires constraints fail (#1579)

* fix(cpp):  SFINAE follow-ups for is_integral_v/is_arithmetic_v bool and char support, an unqualified F1 test fixture, and parameter-lookup gap documentation (#1579) -> claude feedback

* revert: reverting all changes to .md files
2026-05-16 20:23:13 +01:00

27 lines
817 B
C++

// Monotonicity contract: unknown predicates keep both candidates.
// `MyCustomTrait_v` is NOT in the Tier-A registry, so both overloads'
// constraint check returns 'unknown' → both survive narrowing → fall
// through to `isOverloadAmbiguousAfterNormalization` (both have
// parameterTypes=['T']) → edge suppressed.
//
// Asserts CALLS.length === 0 — adding a predicate must never produce a
// wrong edge; the worst case is the pre-existing "degrade not lie"
// suppression.
#include <type_traits>
template<class T>
constexpr bool MyCustomTrait_v = true;
template<class T, std::enable_if_t<MyCustomTrait_v<T>, int> = 0>
void process(T value) {
(void)value;
}
template<class T, std::enable_if_t<!MyCustomTrait_v<T>, int> = 0>
void process(T value) {
(void)value;
}
void run() {
process(42);
}