GitNexus/gitnexus/test/fixtures/lang-resolution/cpp-sfinae-golden/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

21 lines
621 B
C++

// SFINAE golden case (issue #1579).
// Two `process<T>` overloads guarded by mutually-exclusive enable_if_t
// predicates. ISO C++: process(42) → integral overload (line 7);
// process(3.14) → floating overload (line 12). V1 pre-fix: ambiguous,
// 0 CALLS edges. With constraintCompatibility wired up: 2 edges.
#include <type_traits>
template<class T, std::enable_if_t<std::is_integral_v<T>, int> = 0>
void process(T value) {
(void)value;
}
template<class T, std::enable_if_t<std::is_floating_point_v<T>, int> = 0>
void process(T value) {
(void)value;
}
void run() {
process(42);
process(3.14);
}