annotate gcc/testsuite/g++.dg/cpp1z/constexpr-lambda8.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // Testcase from P0170R1
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 // { dg-do compile { target c++17 } }
111
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 auto Fwd = [](int (*fp)(int), auto a) { return fp(a); };
kono
parents:
diff changeset
5 auto C = [](auto a) { return a; };
kono
parents:
diff changeset
6 static_assert( Fwd(C ,3) == 3); // OK
kono
parents:
diff changeset
7 // No specialization of the function call operator template can be constexpr
kono
parents:
diff changeset
8 // (because of the local static).
kono
parents:
diff changeset
9 auto NC = [](auto a) { static int s; return a; }; // { dg-error "static" }
kono
parents:
diff changeset
10 // { dg-message "operator int" "" { target *-*-* } .+1 }
kono
parents:
diff changeset
11 static_assert( Fwd(NC ,3) == 3); // { dg-error "" }
kono
parents:
diff changeset
12
kono
parents:
diff changeset
13 // We look for the string "operator int" to check that we aren't trying to do
kono
parents:
diff changeset
14 // template pretty-printing in an expression; that gets incredibly unwieldy
kono
parents:
diff changeset
15 // with the decltype magic we do for lambdas.