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
This commit is contained in:
Alexandre Oliva 1998-09-11 21:44:37 +00:00 committed by Alexandre Oliva
parent 4525948204
commit 207192d92d
5 changed files with 78 additions and 0 deletions

View 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.

View File

@ -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>();
}

View File

@ -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;

View File

@ -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

View File

@ -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 *-*-*