summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.pt/ttp62.C
blob: 6faabe1945144a0605a954ca8d2e1a28c19084fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// { dg-do run  }
// Origin: Ewgenij Gawrilow <gawrilow@math.TU-Berlin.DE>

extern "C" void abort ();

template <template <class X> class B, class A>
struct is_instance_of {
   enum { answer=false };
};

template <template <class X> class B, class T>
struct is_instance_of<B, B<T> > {
   enum { answer=true };
};

template <class X> struct C { };
template <class X> struct D { };

template <class T>
bool is_C (const T&) {
   return is_instance_of<C,T>::answer;
}

int main() {
   if (!is_C(C<int>()))
      abort ();
   if (is_C(D<int>()))
      abort ();
   return 0;
}