diff options
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.pt/ttp62.C')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/ttp62.C | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ttp62.C b/gcc/testsuite/g++.old-deja/g++.pt/ttp62.C new file mode 100644 index 000000000..6faabe194 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/ttp62.C @@ -0,0 +1,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; +} |