PR c++/86728 - C variadic generic lambda.
[official-gcc.git] / gcc / testsuite / g++.dg / opt / devirt2.C
blobcf4842bd4df346d241ca8d9d0e7bf39403f5e23d
1 // { dg-do compile }
2 // { dg-options "-O2" }
3 /* Using -mshort-calls avoids loading the function addresses in
4    registers and thus getting the counts wrong.  */
5 // { dg-additional-options "-mshort-calls" {target epiphany-*-*} }
6 // Using -mno-abicalls avoids a R_MIPS_JALR .reloc.
7 // { dg-additional-options "-mno-abicalls" { target mips*-*-* } }
8 // { dg-final { scan-assembler-times "xyzzy" 2 { target { ! { alpha*-*-* hppa*-*-* ia64*-*-hpux* sparc*-*-* *-*-mingw* } } } } }
9 // For *-*-mingw* there is additionally one .def match
10 // { dg-final { scan-assembler-times "xyzzy" 3 { target *-*-mingw* } } }
11 // The IA64 and HPPA compilers generate external declarations in addition
12 // to the call so those scans need to be more specific.
13 // { dg-final { scan-assembler-times "br\[^\n\]*xyzzy" 2 { target ia64*-*-hpux* } } }
14 // { dg-final { scan-assembler-times "xyzzy\[^\n\]*,%r" 2 { target hppa*-*-* } } }
15 // If assembler supports explicit relocation directives, the alpha compiler generates
16 // literal/lituse_jsr pairs, so the scans need to be more specific.
17 // { dg-final { scan-assembler-times "jsr\[^\n\]*xyzzy" 2 { target alpha*-*-* } } }
18 // Unless the assembler supports -relax, the 32-bit SPARC compiler generates
19 // sethi/jmp instead of just call, so the scans need to be more specific.
20 // With subexpressions, Tcl regexp -inline -all returns both the complete
21 // match and the subexpressions, so double the count.
22 // { dg-final { scan-assembler-times "\(jmp|call\)\[^\n\]*xyzzy" 4 { target sparc*-*-* } } }
24 struct S { S(); virtual void xyzzy(); };
25 struct R { int a; S s; R(); };
26 S s;
27 R r;
28 inline void foo(S *p) { p->xyzzy(); }
29 void bar() {foo(&s);}
30 void bah() {foo(&r.s);}