Debian Codegraph @

gcc/testsuite/g++.dg/cpp1y/lambda-generic-95451.C

raw
1 // PR c++/95451
2 // { dg-do run { target c++14 } }
3
4 extern "C" void abort ();
5
6 struct A {
7 template <typename>
8 void foo ()
9 {
10 auto b = [this] (auto) { return operator () (); } (0);
11 if (b != 3)
12 abort ();
13 auto c = [this] (int) { return operator () (); } (0);
14 if (c != 3)
15 abort ();
16 }
17 void bar ()
18 {
19 auto d = [this] (auto) { return operator () (); } (0);
20 if (d != 3)
21 abort ();
22 auto e = [this] (int) { return operator () (); } (0);
23 if (e != 3)
24 abort ();
25 }
26 int operator () () { return 3; }
27 };
28
29 int
30 main ()
31 {
32 A a;
33 a.foo<void> ();
34 a.bar ();
35 }