1 // PR c++/78131 2 // { dg-options -std=c++17 } 3 4 template <typename TF> f(TF)5constexpr auto f(TF) 6 { 7 return [](auto...) constexpr { return true; }; 8 } 9 10 // Compiles and works as intended. 11 template <typename T0> ok_0(T0)12void ok_0(T0) 13 { 14 static_assert(f([](auto x) -> decltype(x){})(T0{})); 15 } 16 17 // Compiles and works as intended. 18 template <typename T0> ok_1(T0)19void ok_1(T0) 20 { 21 constexpr auto a = f([](auto x) -> decltype(x){})(T0{}); 22 if constexpr(a) { } 23 } 24 25 // Compile-time error! 26 template <typename T0> fail_0(T0)27void fail_0(T0) 28 { 29 if constexpr(f([](auto x) -> decltype(x){})(T0{})) { } 30 } 31