| 1 |
// PR c++/70906 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-options "-Wall" } |
| 4 |
|
| 5 |
template <typename> struct B; |
| 6 |
template <typename U> struct F { typedef U *t; }; |
| 7 |
template <class> struct D {}; |
| 8 |
template <class VP> struct L { |
| 9 |
typedef VP np; |
| 10 |
typedef typename F<D<VP>>::t cnp; |
| 11 |
}; |
| 12 |
struct P { typedef L<void *> nt; }; |
| 13 |
template <class N> struct I { typedef typename N::template A<int> t; }; |
| 14 |
template <class O1> struct Q { typedef typename I<O1>::t t; }; |
| 15 |
template <class T, class Hook, Hook T::*> struct G; |
| 16 |
template <typename P, typename M, M P::*PM> |
| 17 |
struct mh { |
| 18 |
template <class> struct A { typedef G<P, M, PM> pvt; }; |
| 19 |
}; |
| 20 |
template <typename T> struct B<T *> { static T pt(T); }; |
| 21 |
struct R : public D<void *> { typedef P ht; }; |
| 22 |
class lmh : public R {}; |
| 23 |
template <class T, class Hook, Hook T::*P> struct G { |
| 24 |
typedef Hook Ht; |
| 25 |
typedef typename Ht::ht::nt nt; |
| 26 |
typedef T vt; |
| 27 |
typedef typename nt::np np; |
| 28 |
typedef typename nt::cnp cnp; |
| 29 |
static np tnp(T &); |
| 30 |
static cnp tnp(const T &p1) { |
| 31 |
B<cnp>::pt(static_cast<const Ht &>(p1.*P)); |
| 32 |
return cnp (); |
| 33 |
} |
| 34 |
}; |
| 35 |
template <class T, class S> struct K { |
| 36 |
template <S> struct J; |
| 37 |
template <class U> static int foo(J<U::tnp> *, int); |
| 38 |
static const int c = sizeof(foo<T>(0, 0)); |
| 39 |
}; |
| 40 |
template <class V> struct W1 { |
| 41 |
typedef typename V::vt vt; |
| 42 |
static const bool value = K<V, typename V::np (*)(vt &)>::c == K<V, typename V::cnp (*)(const vt &)>::c; |
| 43 |
}; |
| 44 |
template <class V> struct O { |
| 45 |
static const bool svt = W1<V>::value; |
| 46 |
}; |
| 47 |
template <bool> struct M {}; |
| 48 |
template <class V> class C { |
| 49 |
static const bool svt = O<V>::svt; |
| 50 |
M<svt> m; |
| 51 |
}; |
| 52 |
template <class V> struct H { |
| 53 |
C<V> bar(); |
| 54 |
}; |
| 55 |
template <class O1> struct ml { |
| 56 |
typedef typename Q<O1>::t po; |
| 57 |
typedef H<typename po::pvt> t; |
| 58 |
}; |
| 59 |
template <class O1> class list : public ml<O1>::t {}; |
| 60 |
struct N { |
| 61 |
struct IV { lmh hk; }; |
| 62 |
typedef list<mh<IV, lmh, &IV::hk>> ISL; |
| 63 |
friend void fn1(int &, N const &); |
| 64 |
}; |
| 65 |
void fn1(int &, N const &) { |
| 66 |
N::ISL xl; |
| 67 |
for (xl.bar();;) |
| 68 |
; |
| 69 |
} |