aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@dcc.unicamp.br>1998-09-11 21:44:37 +0000
committerAlexandre Oliva <oliva@gcc.gnu.org>1998-09-11 21:44:37 +0000
commit207192d92dc88077a338d1833b280a0a7a2f4c8f (patch)
tree9a1245952c787cc24cd94846142d71070e840b72 /gcc
parent4525948204e961668798eac88db22247ece8df65 (diff)
downloadgcc-207192d92dc88077a338d1833b280a0a7a2f4c8f.zip
gcc-207192d92dc88077a338d1833b280a0a7a2f4c8f.tar.gz
gcc-207192d92dc88077a338d1833b280a0a7a2f4c8f.tar.bz2
typedef5.C: check whether typedefs can be redefined to the same non-trivial type
* g++.old-deja/g++.other/typedef5.C: check whether typedefs can be redefined to the same non-trivial type * g++.old-deja/g++.pt/explicit73.C: test for proper namespace-qualification of template specializations declared in other namespaces * g++.old-deja/g++.other/friend4.C: check whether it is possible to declare a subset of the specializations of a template function as friends of specializations of a template class * g++.old-deja/g++.pt/explicit71.C: make sure specializations of member templates that do not fully specialize the enclosing template class are rejected From-SVN: r22392
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog17
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/friend4.C23
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/typedef5.C8
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/explicit71.C15
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/explicit73.C15
5 files changed, 78 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 26f214f..2e0d430 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,20 @@
+1998-09-12 Alexandre Oliva <oliva@dcc.unicamp.br>
+
+ * g++.old-deja/g++.other/typedef5.C: check whether typedefs can be
+ redefined to the same non-trivial type
+
+ * g++.old-deja/g++.pt/explicit73.C: test for proper
+ namespace-qualification of template specializations declared in
+ other namespaces
+
+ * g++.old-deja/g++.other/friend4.C: check whether it is possible
+ to declare a subset of the specializations of a template function
+ as friends of specializations of a template class
+
+ * g++.old-deja/g++.pt/explicit71.C: make sure specializations of
+ member templates that do not fully specialize the enclosing
+ template class are rejected
+
1998-09-11 Dave Love <d.love@dl.ac.uk>
* g77.f-torture/execute/u77-test.f: Fix bad consistency checks.
diff --git a/gcc/testsuite/g++.old-deja/g++.other/friend4.C b/gcc/testsuite/g++.old-deja/g++.other/friend4.C
new file mode 100644
index 0000000..a208f5f
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/friend4.C
@@ -0,0 +1,23 @@
+// Build don't link:
+
+// by Alexandre Oliva <oliva@dcc.unicamp.br>
+
+// I'm not 100% sure this program is correct, but g++ shouldn't just
+// crash.
+
+// The idea is to give privileged access to bar<A> only to
+// specializations foo<A,B>, for all B.
+
+template <class A, class B> void foo();
+template <class C> class bar {
+ int i;
+ template <class B> friend void foo<C,B>();
+};
+template <class A, class B> void foo() {
+ bar<A> baz; baz.i = 1;
+ bar<int> buz; buz.i = 1; // ERROR - foo<void,void> cannot access bar<int>::i - XFAIL *-*-*
+}
+int main() {
+ foo<void,void>();
+ foo<int,void>();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/typedef5.C b/gcc/testsuite/g++.old-deja/g++.other/typedef5.C
new file mode 100644
index 0000000..c382088
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/typedef5.C
@@ -0,0 +1,8 @@
+// Build don't link:
+
+// by Alexandre Oliva <oliva@dcc.unicamp.br>
+
+typedef int t;
+typedef t* u;
+typedef int t;
+typedef t* u;
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit71.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit71.C
new file mode 100644
index 0000000..3da4c61
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit71.C
@@ -0,0 +1,15 @@
+// Build don't link:
+// by Alexandre Oliva <oliva@dcc.unicamp.br>
+// Based on a testcase by Reid M. Pinchback <reidmp@MIT.EDU>
+// According to the C++ Standard [temp.expl.spec]/17-18, explicit
+// specializations are only valid if all enclosing template classes
+// of the specialized template are fully specialized too
+
+template <class X>
+class bug {
+ template <class Y>
+ class a {};
+};
+template <class X>
+template <>
+class bug<X>::a<char> {}; // ERROR - invalid specialization
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit73.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit73.C
new file mode 100644
index 0000000..106f573
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit73.C
@@ -0,0 +1,15 @@
+// Build don't link:
+
+// by Alexandre Oliva <oliva@dcc.unicamp.br>
+
+// According to [temp.expl.spec]/2, a template explicit specialization
+// must be declared in the namespace that contains the declaration of
+// the template
+
+namespace N {
+ template <class T> class foo;
+}
+
+using namespace N;
+
+template <> class foo<void>; // ERROR - invalid specialization - XFAIL *-*-*