// PR c++/120555 // { dg-do compile { target c++17 } } struct A { int m; }; template constexpr auto f() { if constexpr (sizeof(T) == sizeof(int)) return 1; else return A{f()}; } static_assert(f().m == 1); static_assert(f() == 1); template constexpr auto g(); template constexpr auto f2() { if constexpr (sizeof(T) == sizeof(int)) return 1; else return A{g()}; // { dg-error "auto" } } template constexpr auto g() { return A{1}; } static_assert(f2().m == 1); static_assert(f2() == 1);