I have compiled and ran the following program in a C++17 compiler (Coliru). In the program, I declared an extern variable, but did not defi
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.