Why does this usage of C++17 if constexpr fail?
This is not possible outside the template! From cppreference.com Outside a template, a discarded statement is fully checked. if constexpr is not a substitute for the #if preprocessing directive: void f() { if constexpr(false) { int i = 0; int *p = i; // Error even though in discarded statement } } Any idea how … Read more