aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-04-05 12:34:20 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-04-05 12:34:20 +0000
commit908c4e83161c7166e0d86864b88d29115b003c5a (patch)
tree381160cbe87945a2d68fddb5e59d42f2fd66730b /gcc
parentd4370213f65e9ebaab7b912ff9de84122e530a23 (diff)
downloadgcc-908c4e83161c7166e0d86864b88d29115b003c5a.zip
gcc-908c4e83161c7166e0d86864b88d29115b003c5a.tar.gz
gcc-908c4e83161c7166e0d86864b88d29115b003c5a.tar.bz2
class.c (maybe_fixup_vptrs): Remove declaration.
* 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. From-SVN: r26202
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/class.c2
-rw-r--r--gcc/cp/decl.c8
-rw-r--r--gcc/cp/search.c3
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/parse2.C8
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/shadow2.C10
6 files changed, 35 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e341bc2..0e3c6fe 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,13 @@
+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.
+
1999-04-04 Mark Mitchell <mark@codesourcery.com>
* pt.c (check_template_shadow): Don't treat OVERLOADs as _DECL
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 6997d01..6b7b98a 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -121,7 +121,6 @@ static void merge_overrides PROTO((tree, tree, int, tree));
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));
@@ -130,7 +129,6 @@ static void modify_all_direct_vtables PROTO((tree, int, tree, tree,
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));
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 63f4fec..0372dae 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4159,9 +4159,6 @@ pushdecl_class_level (x)
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));
@@ -4214,6 +4211,11 @@ push_class_level_binding (name, x)
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
we leave this class. Record the shadowed declaration here. */
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 5f4a76f..99e25a8 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -2943,7 +2943,8 @@ dfs_push_type_decls (binfo, data)
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))
+ && !(!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
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/parse2.C b/gcc/testsuite/g++.old-deja/g++.pt/parse2.C
new file mode 100644
index 0000000..f7b737e6
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/parse2.C
@@ -0,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&);
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/shadow2.C b/gcc/testsuite/g++.old-deja/g++.pt/shadow2.C
new file mode 100644
index 0000000..452e8ca
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/shadow2.C
@@ -0,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;
+