https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120555
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> --- The comment #1 testcase might be over-reduced, it's more interesting if the two branches of the constexpr have different return types: // PR c++/120555 // { dg-do compile { target c++17 } } struct A { int m; }; template<class T> constexpr auto f() { if constexpr (__is_same(T, int)) return 1; else return A{f<int>()}; } static_assert(f<bool>().m == 1); static_assert(f<int>() == 1);