Why doesn't an if constexpr make this core constant expression error disappear?
问题 In reference to this question. The core constant expression that is used to initialize the constexpr variable y is ill-formed. So much is a given. But if I try to turn the if into an if constexpr : template <typename T> void foo() { constexpr int x = -1; if constexpr (x >= 0){ constexpr int y = 1 << x; } } int main(){ foo<int>(); } The error persists. With GCC 7.2 still giving: error: right operand of shift expression '(1 << -1)' is negative [-fpermissive] But I thought that the semantic