2 // { dg-do compile { target c++23 } }
4 // instantiating captureless lambda call operator with unrelated explicit object parameter
8 auto f0 = [](this auto self) { return self; };
9 auto fp0_value = static_cast<int(*)(int) >(&decltype(f0)::operator());
10 auto fp0_lref = static_cast<int(*)(int&) >(&decltype(f0)::operator());
11 auto fp0_rref = static_cast<int(*)(int&&) >(&decltype(f0)::operator());
12 auto fp0_constlref = static_cast<int(*)(int const&) >(&decltype(f0)::operator());
13 auto fp0_constrref = static_cast<int(*)(int const&&)>(&decltype(f0)::operator());
15 auto f1 = [](this auto&& self) { return self; };
16 auto fp1_value = static_cast<int(*)(int) >(&decltype(f1)::operator()); // { dg-error {invalid 'static_cast' from type} }
17 auto fp1_lref = static_cast<int(*)(int&) >(&decltype(f1)::operator());
18 auto fp1_rref = static_cast<int(*)(int&&) >(&decltype(f1)::operator());
19 auto fp1_constlref = static_cast<int(*)(int const&) >(&decltype(f1)::operator());
20 auto fp1_constrref = static_cast<int(*)(int const&&)>(&decltype(f1)::operator());
25 auto f0 = [](this auto self) { return self; };
26 int (*fp0_value)(int) = &decltype(f0)::operator();
27 int (*fp0_lref)(int&) = &decltype(f0)::operator();
28 int (*fp0_rref)(int&&) = &decltype(f0)::operator();
29 int (*fp0_constlref)(int const&) = &decltype(f0)::operator();
30 int (*fp0_constrref)(int const&&) = &decltype(f0)::operator();
32 auto f1 = [](this auto&& self) { return self; };
33 int (*fp1_value)(int) = &decltype(f1)::operator(); // { dg-error {no matches converting function} }
34 int (*fp1_lref)(int&) = &decltype(f1)::operator();
35 int (*fp1_rref)(int&&) = &decltype(f1)::operator();
36 int (*fp1_constlref)(int const&) = &decltype(f1)::operator();
37 int (*fp1_constrref)(int const&&) = &decltype(f1)::operator();