2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wall" }
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 {
10 typedef typename F<D<VP>>::t cnp;
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>
18 template <class> struct A { typedef G<P, M, PM> pvt; };
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 {
25 typedef typename Ht::ht::nt nt;
27 typedef typename nt::np np;
28 typedef typename nt::cnp cnp;
30 static cnp tnp(const T &p1) {
31 B<cnp>::pt(static_cast<const Ht &>(p1.*P));
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));
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;
44 template <class V> struct O {
45 static const bool svt = W1<V>::value;
47 template <bool> struct M {};
48 template <class V> class C {
49 static const bool svt = O<V>::svt;
52 template <class V> struct H {
55 template <class O1> struct ml {
56 typedef typename Q<O1>::t po;
57 typedef H<typename po::pvt> t;
59 template <class O1> class list : public ml<O1>::t {};
61 struct IV { lmh hk; };
62 typedef list<mh<IV, lmh, &IV::hk>> ISL;
63 friend void fn1(int &, N const &);
65 void fn1(int &, N const &) {