| 1 |
// { dg-do compile { target c++17 } } |
| 2 |
// { dg-options "-O2 -fno-exceptions -Wno-return-type" } |
| 3 |
|
| 4 |
template <class a> struct b { typedef a *c; }; |
| 5 |
class e {}; |
| 6 |
template <typename a> class d { |
| 7 |
public: |
| 8 |
typedef typename b<a>::c c; |
| 9 |
c begin(); |
| 10 |
c end(); |
| 11 |
}; |
| 12 |
struct f { |
| 13 |
enum { g } h; |
| 14 |
}; |
| 15 |
struct i { |
| 16 |
d<f *> j(); |
| 17 |
}; |
| 18 |
struct l { |
| 19 |
d<i *> k(); |
| 20 |
}; |
| 21 |
class ac; |
| 22 |
class o { |
| 23 |
public: |
| 24 |
o(int *, int *, int *, ac *); |
| 25 |
}; |
| 26 |
class ac { |
| 27 |
public: |
| 28 |
ac(e); |
| 29 |
virtual o *ae(int *, int *, int *, int *); |
| 30 |
}; |
| 31 |
class p { |
| 32 |
void af(f *m) { |
| 33 |
switch (m->h) |
| 34 |
case f::g: |
| 35 |
ag(); |
| 36 |
} |
| 37 |
|
| 38 |
public: |
| 39 |
void n() { |
| 40 |
l ah; |
| 41 |
for (i *ai : ah.k()) |
| 42 |
for (f *m : ai->j()) |
| 43 |
af(m); |
| 44 |
} |
| 45 |
virtual void ag() { __builtin_unreachable(); } |
| 46 |
}; |
| 47 |
template <typename = int> class an : o { |
| 48 |
public: |
| 49 |
an(int *, int *, int *, int *, ac *); |
| 50 |
}; |
| 51 |
class q : ac { |
| 52 |
public: |
| 53 |
q() : ac([]() -> e {}()) {} |
| 54 |
o *ae(int *ap, int *aq, int *ar, int *as) { an(ap, aq, ar, as, this); } |
| 55 |
}; |
| 56 |
template <typename at> |
| 57 |
an<at>::an(int *, int *aq, int *ar, int *as, ac *au) : o(aq, ar, as, au) { |
| 58 |
p().n(); |
| 59 |
} |
| 60 |
void av() { new q; } |