aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.old-deja/g++.pt/sizeof2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.old-deja/g++.pt/sizeof2.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.old-deja/g++.pt/sizeof2.C21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.old-deja/g++.pt/sizeof2.C b/gcc-4.9/gcc/testsuite/g++.old-deja/g++.pt/sizeof2.C
new file mode 100644
index 000000000..97127ea0f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.old-deja/g++.pt/sizeof2.C
@@ -0,0 +1,21 @@
+// { dg-do run }
+// Although template class B is not used at all, it causes the
+// incorrect specialization of A to be selected
+
+// Adapted from testcase by Oskar Enoksson <osken393@student.liu.se>
+
+extern "C" void abort();
+
+template<int N, class T> // Base class
+class A { public: static int n() { return sizeof(T); } };
+
+template<int N> // Derived #1
+class B: public A<N,char[N]> {};
+
+template<int N, int M> // Derived #2 (wrong!)
+class C: public A<N,char[M]> {};
+
+int main() {
+ if (C<1,2>::n() != 2)
+ abort();
+}