aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@dcc.unicamp.br>1998-10-31 01:54:35 +0000
committerAlexandre Oliva <oliva@gcc.gnu.org>1998-10-31 01:54:35 +0000
commite1a96a5729b45f77160029277379c72276cf94e9 (patch)
tree85ea53afbd6abdc02ea81296b1fc495287c1a1a2
parent7e0a7fc28e2142db6e3946bf2e32453ed468b6dc (diff)
downloadgcc-e1a96a5729b45f77160029277379c72276cf94e9.zip
gcc-e1a96a5729b45f77160029277379c72276cf94e9.tar.gz
gcc-e1a96a5729b45f77160029277379c72276cf94e9.tar.bz2
sizeof2.C: incorrect specialization of base template is selected
* g++.old-deja/g++.pt/sizeof2.C: incorrect specialization of base template is selected From-SVN: r23468
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/sizeof2.C22
2 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 42417b8..5ea28f5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
1998-10-31 Alexandre Oliva <oliva@dcc.unicamp.br>
+ * g++.old-deja/g++.pt/sizeof2.C: incorrect specialization of base
+ template is selected
+
* g++.old-deja/g++.ext/arrnew2.C: if new T[n](i) is accepted for
classes, it should be accepted for all types.
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/sizeof2.C b/gcc/testsuite/g++.old-deja/g++.pt/sizeof2.C
new file mode 100644
index 0000000..fba3ed6
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/sizeof2.C
@@ -0,0 +1,22 @@
+// 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>
+
+// execution test - XFAIL *-*-*
+
+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();
+}