1 // Testcase from P0170R1
2 // { dg-options -std=c++1z }
4 auto Fwd = [](int (*fp)(int), auto a) { return fp(a); };
5 auto C = [](auto a) { return a; };
6 static_assert( Fwd(C ,3) == 3); // OK
7 // No specialization of the function call operator template can be constexpr
8 // (because of the local static).
9 auto NC = [](auto a) { static int s; return a; }; // { dg-error "static" }
10 // { dg-message "operator int" "" { target *-*-* } 11 }
11 static_assert( Fwd(NC ,3) == 3); // { dg-error "" }
13 // We look for the string "operator int" to check that we aren't trying to do
14 // template pretty-printing in an expression; that gets incredibly unwieldy
15 // with the decltype magic we do for lambdas.