Debian Codegraph @

gcc/testsuite/g++.dg/cpp23/static-operator-call2.C

raw
1 // P1169R4 - static operator()
2 // { dg-do compile { target c++11 } }
3 // { dg-options "" }
4
5 void
6 foo ()
7 {
8 int u = 0;
9 auto a = [](int x, int y) mutable mutable { return x + y; }; // { dg-error "duplicate 'mutable' specifier" }
10 auto b = [](int x, int y) static static { return x + y; }; // { dg-error "duplicate 'static' specifier" }
11 // { dg-warning "'static' only valid in lambda with" "" { target c++20_down } .-1 }
12 auto c = [](int x, int y) static mutable { return x + y; }; // { dg-error "'mutable' specifier conflicts with 'static'" }
13 // { dg-warning "'static' only valid in lambda with" "" { target c++20_down } .-1 }
14 auto d = [](int x, int y) mutable static { return x + y; }; // { dg-error "'static' specifier conflicts with 'mutable'" }
15 // { dg-warning "'static' only valid in lambda with" "" { target c++20_down } .-1 }
16 auto e = [=](int x, int y) static { return x + y; }; // { dg-error "lambda specifier with lambda capture" }
17 // { dg-warning "'static' only valid in lambda with" "" { target c++20_down } .-1 }
18 auto f = [&](int x, int y) static { return x + y; }; // { dg-error "lambda specifier with lambda capture" }
19 // { dg-warning "'static' only valid in lambda with" "" { target c++20_down } .-1 }
20 auto g = [u](int x, int y) static { return x + y; }; // { dg-error "lambda specifier with lambda capture" }
21 // { dg-warning "'static' only valid in lambda with" "" { target c++20_down } .-1 }
22 }