| 1 |
// PR debug/52048 |
| 2 |
// { dg-do compile } |
| 3 |
// { dg-options "-fcompare-debug -fnon-call-exceptions -fno-tree-dominator-opts -O2 -Wno-return-type" } |
| 4 |
|
| 5 |
template <typename T> struct A; |
| 6 |
template <typename T> |
| 7 |
struct A <T *> |
| 8 |
{ |
| 9 |
typedef T &a; |
| 10 |
}; |
| 11 |
template <typename T> |
| 12 |
struct B |
| 13 |
{ |
| 14 |
typedef typename A <T>::a a; |
| 15 |
a operator *() {} |
| 16 |
}; |
| 17 |
template <typename T, typename U> |
| 18 |
bool operator != (B <T>, B <U>) |
| 19 |
{ |
| 20 |
} |
| 21 |
template <typename T> |
| 22 |
struct C |
| 23 |
{ |
| 24 |
typedef T *c; |
| 25 |
template <typename> |
| 26 |
struct D { typedef C d; }; |
| 27 |
}; |
| 28 |
template <typename T, typename U> struct E |
| 29 |
{ |
| 30 |
typedef typename U::template D <T>::d e; |
| 31 |
}; |
| 32 |
template <typename T, typename U = C <T> > |
| 33 |
struct F |
| 34 |
{ |
| 35 |
typedef E <T, U> b; |
| 36 |
typedef typename b::e e; |
| 37 |
typedef typename e::c c; |
| 38 |
typedef B <c> i; |
| 39 |
i begin (); |
| 40 |
i end (); |
| 41 |
}; |
| 42 |
class G; |
| 43 |
class H; |
| 44 |
struct I |
| 45 |
{ |
| 46 |
void *i; |
| 47 |
template <typename T> T foo (); |
| 48 |
}; |
| 49 |
struct J : public I |
| 50 |
{ |
| 51 |
virtual bool bar (); |
| 52 |
}; |
| 53 |
class K {}; |
| 54 |
struct L |
| 55 |
{ |
| 56 |
bool baz () {} |
| 57 |
}; |
| 58 |
struct M |
| 59 |
{ |
| 60 |
K m1 (K); |
| 61 |
K m2 (H *) {} |
| 62 |
}; |
| 63 |
struct N : J |
| 64 |
{ |
| 65 |
bool bar (G &); |
| 66 |
}; |
| 67 |
bool |
| 68 |
N::bar (G &) |
| 69 |
{ |
| 70 |
M m = foo <M> (); |
| 71 |
F <H *> f; |
| 72 |
for (F <H *>::i I = f.begin (), E = f.end (); I != E;) |
| 73 |
{ |
| 74 |
H *h = *I; |
| 75 |
L l; |
| 76 |
if (l.baz ()) |
| 77 |
m.m1 (m.m2 (h)); |
| 78 |
} |
| 79 |
} |