re PR c++/72 (aggressive type analysis in template-class's template-member-function)

cp:
	PR g++/72
	* decl.c (add_binding): Don't reject duplicate typedefs involving
	template parameters.
testsuite:
	* g++.dg/template/typedef1.C: New test.

From-SVN: r47854
This commit is contained in:
Nathan Sidwell 2001-12-10 22:49:13 +00:00 committed by Nathan Sidwell
parent fe7f56777e
commit 9aaceb4b3e
4 changed files with 38 additions and 3 deletions

View File

@ -1,8 +1,14 @@
2001-12-10 Nathan Sidwell <nathan@codesourcery.com>
PR g++/72
* decl.c (add_binding): Don't reject duplicate typedefs involving
template parameters.
2001-12-10 Neil Booth <neil@daikokuya.demon.co.uk>
* parse.y, semantics.c: Similarly.
2001-12-04 Nathan Sidwell <nathan@codesourcery.com>
2001-12-09 Nathan Sidwell <nathan@codesourcery.com>
PR g++/87
* cp-tree.h (DECL_COPY_CONSTRUCTOR_P): Use copy_fn_p.

View File

@ -981,8 +981,12 @@ add_binding (id, decl)
else if (TREE_CODE (BINDING_VALUE (binding)) == TYPE_DECL
&& TREE_CODE (decl) == TYPE_DECL
&& DECL_NAME (decl) == DECL_NAME (BINDING_VALUE (binding))
&& same_type_p (TREE_TYPE (decl),
TREE_TYPE (BINDING_VALUE (binding))))
&& (same_type_p (TREE_TYPE (decl),
TREE_TYPE (BINDING_VALUE (binding)))
/* If either type involves template parameters, we must
wait until instantiation. */
|| uses_template_parms (TREE_TYPE (decl))
|| uses_template_parms (TREE_TYPE (BINDING_VALUE (binding)))))
/* We have two typedef-names, both naming the same type to have
the same name. This is OK because of:

View File

@ -1,3 +1,7 @@
2001-12-10 Nathan Sidwell <nathan@codesourcery.com>
* g++.dg/template/typedef1.C: New test.
2001-12-09 Nathan Sidwell <nathan@codesourcery.com>
* g++.dg/other/copy1.C: New test.

View File

@ -0,0 +1,21 @@
// { dg-do compile }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 9 Dec 2001 <nathan@nathan@codesourcery.com>
// PR 72
template <typename T> struct A
{
typedef T type;
};
template <typename T> struct B
{
typedef int xxx;
typedef T xxx;
typedef typename A<T>::type xxx;
typedef A<int>::type xxx;
};
B<int> good;