gcc/testsuite/g++.dg/cpp23/explicit-obj-lambda5.C
raw| 1 | // P0847R7 |
| 2 | // { dg-do run { target c++23 } } |
| 3 | |
| 4 | // calls to (captureless) lambda with explicit object parameter of unrelated type |
| 5 | // with an appropriate converting constructor |
| 6 | |
| 7 | inline constexpr int magic = 42; |
| 8 | |
| 9 | struct S { |
| 10 | int _v; |
| 11 | template<typename T> |
| 12 | S(T) : _v(magic) {} |
| 13 | }; |
| 14 | |
| 15 | int main() |
| 16 | { |
| 17 | auto f = [](this S self){ return self._v; }; |
| 18 | if (f () != magic) |
| 19 | __builtin_abort (); |
| 20 | } |
| 21 |