https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117272
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So in the case of if/else, only one side of the if/else is used as it is both sides are constrained due to the `if constexpr ` while in your second case the if is constrained but the rest of the function is not. That is it is similar to: ``` #include <type_traits> template <typename> constexpr bool always_false = false; template<typename T> void f(){ if constexpr(std::is_same_v<T, int>) { return; } static_assert(always_false<T>); } int main() { f<int>(); } ``` Which will fail the same way too due to that.