2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1z / constexpr-lambda17.C
blob89585f3a39512fda0f750aab2aa6f6e803faab24
1 // PR c++/78131
2 // { dg-do compile { target c++17 } }
4 template <typename TF>
5 constexpr auto f(TF)
7     return [](auto...) constexpr { return true; };
8 }   
10 // Compiles and works as intended.
11 template <typename T0>
12 void ok_0(T0)
14     static_assert(f([](auto x) -> decltype(x){})(T0{}));
17 // Compiles and works as intended.
18 template <typename T0>
19 void ok_1(T0)
21     constexpr auto a = f([](auto x) -> decltype(x){})(T0{});
22     if constexpr(a) { }
25 // Compile-time error!
26 template <typename T0>
27 void fail_0(T0)
29     if constexpr(f([](auto x) -> decltype(x){})(T0{})) { }