| 1 |
// PR debug/47283 |
| 2 |
// { dg-do compile } |
| 3 |
|
| 4 |
template <typename T> inline const T & |
| 5 |
f1 (const T &a, const T &b) |
| 6 |
{ |
| 7 |
if (a < b) |
| 8 |
return b; |
| 9 |
return a; |
| 10 |
}; |
| 11 |
|
| 12 |
struct A |
| 13 |
{ |
| 14 |
A (int w, int h) { a1 = w; } |
| 15 |
A f2 (const A &) const; |
| 16 |
int a1, a2; |
| 17 |
}; |
| 18 |
|
| 19 |
inline A |
| 20 |
A::f2 (const A &x) const |
| 21 |
{ |
| 22 |
return A (f1 (a1, x.a1), f1 (a2, x.a2)); |
| 23 |
}; |
| 24 |
|
| 25 |
struct B |
| 26 |
{ |
| 27 |
A f3 () const; |
| 28 |
void f4 (const A &) { b2 = 5 + b1; } |
| 29 |
int b1, b2; |
| 30 |
}; |
| 31 |
|
| 32 |
struct C |
| 33 |
{ |
| 34 |
}; |
| 35 |
|
| 36 |
struct D |
| 37 |
{ |
| 38 |
virtual C f5 (const C &) const; |
| 39 |
}; |
| 40 |
|
| 41 |
struct E |
| 42 |
{ |
| 43 |
C f6 () const; |
| 44 |
int f7 () const; |
| 45 |
virtual B f8 (const C &) const; |
| 46 |
A f9 () const; |
| 47 |
virtual void f10 (); |
| 48 |
struct F { D *h; } *d; |
| 49 |
}; |
| 50 |
|
| 51 |
void |
| 52 |
E::f10 () |
| 53 |
{ |
| 54 |
const C c = d->h->f5 (f6 ()); |
| 55 |
B b = f8 (c); |
| 56 |
b.f4 (b.f3 ().f2 (f9 ())); |
| 57 |
f7 (); |
| 58 |
} |