Why doesn’t this “undefined extern variable” result in a linker error in C++17?
Because the variable isn’t odr-used. You have a constexpr if there that always discards the branch that could use it. One of the points of constexpr if is that the discarded branch need not even compile, only be well-formed. That’s how we can place calls to non-existing member functions in a discarded branch.