Debian Codegraph @

gcc/testsuite/g++.dg/abi/lambda-static-1.C

raw
1 // { dg-do compile { target { c++14 && comdat_group } } }
2 // { dg-additional-options -fno-inline }
3
4 inline auto lamby ()
5 {
6 return [] {};
7 }
8
9 void direct ()
10 {
11 lamby ()();
12 }
13
14 void indirect ()
15 {
16 void (*invoke) () = lamby ();
17
18 invoke ();
19 }
20
21 // The call operator and the static invoker should be comdat, but not
22 // the same group. (that would be a compiler incompatibility)
23
24 // { dg-final { scan-assembler ".section\[\t ]*.text._ZZ5lambyvENKUlvE_clEv,\[^\n\r]*,_ZZ5lambyvENKUlvE_clEv,comdat" { target { { ! *-*-solaris2.* } || { gas } } } } }
25 // { dg-final { scan-assembler ".section\[\t ]*.text._ZZ5lambyvENUlvE_4_FUNEv,\[^\n\r]*,_ZZ5lambyvENUlvE_4_FUNEv,comdat" { target { { ! *-*-solaris2.* } || { gas } } } } }
26 // { dg-final { scan-assembler ".group\[\t \]*_ZZ5lambyvENKUlvE_clEv,\[^\n\r\]*,#comdat" { target { *-*-solaris2.* && { ! gas } } } } }
27 // { dg-final { scan-assembler ".group\[\t \]*_ZZ5lambyvENUlvE_4_FUNEv,\[^\n\r\]*,#comdat" { target { *-*-solaris2.* && { ! gas } } } } }