diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2001-12-10 22:49:13 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2001-12-10 22:49:13 +0000 |
commit | 9aaceb4b3e161bc4ce5d2265bf6d3a95d1e62d66 (patch) | |
tree | c532d8ef3f62098fc08d9984820494614a90768e | |
parent | fe7f56777e48623bb55fa7edfc53f9eac9d208c2 (diff) | |
download | gcc-9aaceb4b3e161bc4ce5d2265bf6d3a95d1e62d66.zip gcc-9aaceb4b3e161bc4ce5d2265bf6d3a95d1e62d66.tar.gz gcc-9aaceb4b3e161bc4ce5d2265bf6d3a95d1e62d66.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/decl.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/typedef1.C | 21 |
4 files changed, 38 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a8c08a2..880ef3f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 26d3a24..8bf940e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9c77430..a7766e9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/g++.dg/template/typedef1.C b/gcc/testsuite/g++.dg/template/typedef1.C new file mode 100644 index 0000000..0325757 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/typedef1.C @@ -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; |