OSDN Git Service

* g++.old-deja/g++.other/typedef5.C: check whether typedefs can be
authoroliva <oliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 Sep 1998 21:44:37 +0000 (21:44 +0000)
committeroliva <oliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 Sep 1998 21:44:37 +0000 (21:44 +0000)
  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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@22392 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.other/friend4.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.other/typedef5.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit71.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit73.C [new file with mode: 0644]

index 26f214f..2e0d430 100644 (file)
@@ -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 (file)
index 0000000..a208f5f
--- /dev/null
@@ -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 (file)
index 0000000..c382088
--- /dev/null
@@ -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 (file)
index 0000000..3da4c61
--- /dev/null
@@ -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 (file)
index 0000000..106f573
--- /dev/null
@@ -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 *-*-*