This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCHes for minor buglets
- To: egcs-patches at egcs dot cygnus dot com
- Subject: C++ PATCHes for minor buglets
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Mon, 5 Apr 1999 12:37:34 -0700
- Reply-to: mark at codesourcery dot com
This patch fixes up a couple of problems introduced by recent changes.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
1999-04-05 Mark Mitchell <mark@codesourcery.com>
* class.c (maybe_fixup_vptrs): Remove declaration.
(build_class_init_list): Likewise.
* decl.c (pushdecl_class_level): Call check_template_shadow here
...
(push_class_level_binding): ... not here.
* search.c (dfs_push_type_decls): Only avoid
template-self-reference TYPE_DECLs if they are from base classes.
Index: testsuite/g++.old-deja/g++.pt/parse2.C
===================================================================
RCS file: parse2.C
diff -N parse2.C
*** /dev/null Sat Dec 5 20:30:03 1998
--- parse2.C Mon Apr 5 12:18:16 1999
***************
*** 0 ****
--- 1,8 ----
+ // Build don't link:
+ // Origin: Jason Merrill <jason@cygnus.com>
+
+ template <class T> struct A {
+ A (const A&) { }
+ };
+
+ template A<int>::A (const A&);
Index: testsuite/g++.old-deja/g++.pt/shadow2.C
===================================================================
RCS file: shadow2.C
diff -N shadow2.C
*** /dev/null Sat Dec 5 20:30:03 1998
--- shadow2.C Mon Apr 5 12:18:16 1999
***************
*** 0 ****
--- 1,10 ----
+ // Build don't link:
+ // Origin: Jason Merrill <jason@cygnus.com>
+
+ template <class T> struct A { // ERROR - shadowed parameter
+ struct B {
+ void T(); // ERROR - shadows template parameter
+ };
+ };
+ A<int> a;
+
Index: testsuite/g++.old-deja/cp/class.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/class.c,v
retrieving revision 1.141
diff -c -p -r1.141 class.c
*** class.c 1999/04/03 01:23:24 1.141
--- class.c 1999/04/05 19:18:31
*************** static void merge_overrides PROTO((tree,
*** 121,127 ****
static void override_one_vtable PROTO((tree, tree, tree));
static void mark_overriders PROTO((tree, tree));
static void check_for_override PROTO((tree, tree));
- static tree maybe_fixup_vptrs PROTO((tree, tree, tree));
static tree get_class_offset_1 PROTO((tree, tree, tree, tree, tree));
static tree get_class_offset PROTO((tree, tree, tree, tree));
static void modify_one_vtable PROTO((tree, tree, tree, tree));
--- 121,126 ----
*************** static void modify_all_direct_vtables PR
*** 130,136 ****
tree));
static void modify_all_indirect_vtables PROTO((tree, int, int, tree,
tree, tree));
- static void build_class_init_list PROTO((tree));
static int finish_base_struct PROTO((tree, struct base_info *));
static void finish_struct_methods PROTO((tree));
static void maybe_warn_about_overly_private_class PROTO ((tree));
--- 129,134 ----
Index: testsuite/g++.old-deja/cp/decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.333
diff -c -p -r1.333 decl.c
*** decl.c 1999/04/02 15:36:08 1.333
--- decl.c 1999/04/05 19:18:39
*************** pushdecl_class_level (x)
*** 4159,4167 ****
if (name)
{
- if (TYPE_BEING_DEFINED (current_class_type))
- check_template_shadow (x);
-
push_class_level_binding (name, x);
if (TREE_CODE (x) == TYPE_DECL)
set_identifier_type_value (name, TREE_TYPE (x));
--- 4159,4164 ----
*************** push_class_level_binding (name, x)
*** 4213,4218 ****
--- 4210,4220 ----
parameter name in a member template. */
if (!class_binding_level)
return;
+
+ /* Make sure that this new member does not have the same name
+ as a template parameter. */
+ if (TYPE_BEING_DEFINED (current_class_type))
+ check_template_shadow (x);
/* If this declaration shadows a declaration from an enclosing
class, then we will need to restore IDENTIFIER_CLASS_VALUE when
Index: testsuite/g++.old-deja/cp/search.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/search.c,v
retrieving revision 1.91
diff -c -p -r1.91 search.c
*** search.c 1999/04/02 15:36:53 1.91
--- search.c 1999/04/05 19:18:46
*************** dfs_push_type_decls (binfo, data)
*** 2943,2949 ****
type = BINFO_TYPE (binfo);
for (fields = TYPE_FIELDS (type); fields; fields = TREE_CHAIN (fields))
if (DECL_NAME (fields) && TREE_CODE (fields) == TYPE_DECL
! && !template_self_reference_p (type, fields))
setup_class_bindings (DECL_NAME (fields), /*type_binding_p=*/1);
/* We can't just use BINFO_MARKED because envelope_add_decl uses
--- 2943,2950 ----
type = BINFO_TYPE (binfo);
for (fields = TYPE_FIELDS (type); fields; fields = TREE_CHAIN (fields))
if (DECL_NAME (fields) && TREE_CODE (fields) == TYPE_DECL
! && !(!same_type_p (type, current_class_type)
! && template_self_reference_p (type, fields)))
setup_class_bindings (DECL_NAME (fields), /*type_binding_p=*/1);
/* We can't just use BINFO_MARKED because envelope_add_decl uses