OSDN Git Service

* gcc.dg/20020201-1.c: Use cleanup-coverage_files.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.pt / sizeof2.C
1 // { dg-do run  }
2 // Although template class B is not used at all, it causes the
3 // incorrect specialization of A to be selected
4
5 // Adapted from testcase by Oskar Enoksson <osken393@student.liu.se>
6
7 extern "C" void abort();
8
9 template<int N, class T> // Base class
10 class A { public: static int n() { return sizeof(T); } };
11
12 template<int N> // Derived #1
13 class B: public A<N,char[N]> {};
14
15 template<int N, int M> // Derived #2 (wrong!)
16 class C: public A<N,char[M]> {};
17
18 int main() {
19   if (C<1,2>::n() != 2)
20     abort();
21 }