Debian Codegraph @

gcc/testsuite/g++.dg/abi/lambda-ctx2.h

raw
1 // PR c++/107741
2
3 void side_effect();
4
5 struct A {
6 static constexpr auto x = []{ return 1; };
7 };
8
9 template <typename>
10 struct B {
11 static inline auto x = (side_effect(), []{ return 2; }(), []{ return 3; }());
12 };
13
14 template <typename>
15 struct C {
16 static int x;
17 };
18
19 template <typename T>
20 int C<T>::x = (side_effect(), []{ return 4; }());
21
22 template int C<int>::x;
23
24 int f() {
25 A::x();
26 return B<int>::x;
27 }
28
29 struct D {
30 template <typename>
31 static constexpr auto x = []{ return 5; };
32 };
33
34 template <typename>
35 struct E {
36 template <typename>
37 static inline auto x = (side_effect(), []{ return 6; }(), []{ return 7; }());
38 };
39
40 int g() {
41 D::x<int>();
42 return E<int>::x<int>;
43 }