From a24fa42456ecb51621e83aceb84d1e447c185542 Mon Sep 17 00:00:00 2001 From: oliva Date: Fri, 11 Sep 1998 21:44:37 +0000 Subject: [PATCH] * 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@22392 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 17 +++++++++++++++++ gcc/testsuite/g++.old-deja/g++.other/friend4.C | 23 +++++++++++++++++++++++ gcc/testsuite/g++.old-deja/g++.other/typedef5.C | 8 ++++++++ gcc/testsuite/g++.old-deja/g++.pt/explicit71.C | 15 +++++++++++++++ gcc/testsuite/g++.old-deja/g++.pt/explicit73.C | 15 +++++++++++++++ 5 files changed, 78 insertions(+) create mode 100644 gcc/testsuite/g++.old-deja/g++.other/friend4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.other/typedef5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit71.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit73.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 26f214f589e..2e0d430a5b0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,20 @@ +1998-09-12 Alexandre Oliva + + * 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 * 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 00000000000..a208f5fe307 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/friend4.C @@ -0,0 +1,23 @@ +// Build don't link: + +// by Alexandre Oliva + +// I'm not 100% sure this program is correct, but g++ shouldn't just +// crash. + +// The idea is to give privileged access to bar only to +// specializations foo, for all B. + +template void foo(); +template class bar { + int i; + template friend void foo(); +}; +template void foo() { + bar baz; baz.i = 1; + bar buz; buz.i = 1; // ERROR - foo cannot access bar::i - XFAIL *-*-* +} +int main() { + foo(); + foo(); +} 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 00000000000..c382088ef6e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/typedef5.C @@ -0,0 +1,8 @@ +// Build don't link: + +// by Alexandre Oliva + +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 00000000000..3da4c61dc3f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit71.C @@ -0,0 +1,15 @@ +// Build don't link: +// by Alexandre Oliva +// Based on a testcase by Reid M. Pinchback +// 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 bug { + template + class a {}; +}; +template +template <> +class bug::a {}; // 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 00000000000..106f573c625 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit73.C @@ -0,0 +1,15 @@ +// Build don't link: + +// by Alexandre Oliva + +// 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 foo; +} + +using namespace N; + +template <> class foo; // ERROR - invalid specialization - XFAIL *-*-* -- 2.11.0