| 1 |
// PR middle-end/51929 |
| 2 |
// { dg-do compile } |
| 3 |
// { dg-options "-O -fno-guess-branch-probability -fipa-cp -fipa-cp-clone --param=max-inline-insns-single=25" } |
| 4 |
|
| 5 |
struct A |
| 6 |
{ |
| 7 |
A (A, unsigned); |
| 8 |
A (const char *); |
| 9 |
~A () { a1 (a4 ()); } |
| 10 |
void a1 (int); |
| 11 |
unsigned a2 (); |
| 12 |
char *a3 (); |
| 13 |
int a4 (); |
| 14 |
}; |
| 15 |
|
| 16 |
template <typename T> |
| 17 |
struct B |
| 18 |
{ |
| 19 |
A b; |
| 20 |
B (A x, int y = 1) : b (x.a3 (), x.a2 ()) { if (y & 1) b.a2 (); } |
| 21 |
}; |
| 22 |
|
| 23 |
extern template struct B <char>; |
| 24 |
A a1 ("foo"), a2 ("bar"); |
| 25 |
B<char> b1 (a1), b2 (a2, 8); |
| 26 |
|
| 27 |
void |
| 28 |
foo () |
| 29 |
{ |
| 30 |
A a3 ("baz"); |
| 31 |
B<char> b3 (a1), b4 (a3); |
| 32 |
} |