public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* An OVL_CURRENT patch?
@ 1998-05-09 17:36 H.J. Lu
  1998-05-10  2:05 ` Martin von Loewis
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 1998-05-09 17:36 UTC (permalink / raw)
  To: loewis; +Cc: egcs

Hi,

Does this patch make any sense? Should we check all usages of
TREE_VEC_ELT to see if OVL_CURRENT is needed?

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
---
Sat May  9 17:30:35 1998  H.J. Lu  (hjl@gnu.org)

	* class.c (finish_struct_1): Use OVL_CURRENT on TREE_VEC_ELT.
	* decl2.c (constructor_name_full): Likewise.

Index: class.c
===================================================================
RCS file: /home/work/cvs/gnu/egcs/gcc/cp/class.c,v
retrieving revision 1.1.1.29
diff -u -p -r1.1.1.29 class.c
--- class.c	1998/05/09 20:35:19	1.1.1.29
+++ class.c	1998/05/10 00:23:49
@@ -3705,7 +3705,8 @@ finish_struct_1 (t, warn_anon)
 	name = DECL_NAME (fdecl);
 
 	for (; i < n_methods; i++)
-	  if (DECL_NAME (TREE_VEC_ELT (method_vec, i)) == name)
+	  if (DECL_NAME (OVL_CURRENT (TREE_VEC_ELT (method_vec, i)))
+		== name)
 	    {
 	      cp_error ("cannot adjust access to `%#D' in `%#T'", fdecl, t);
 	      cp_error_at ("  because of local method `%#D' with same name",
@@ -3821,7 +3822,8 @@ finish_struct_1 (t, warn_anon)
 	    continue;
 
 	  for (; i < n_methods; ++i)
-	    if (DECL_NAME (TREE_VEC_ELT (method_vec, i)) == name)
+	    if (DECL_NAME (OVL_CURRENT (TREE_VEC_ELT (method_vec, i)))
+		== name)
 	      {
 		cp_error_at ("data member `%#D' conflicts with", x);
 		cp_error_at ("function member `%#D'",
Index: decl2.c
===================================================================
RCS file: /home/work/cvs/gnu/egcs/gcc/cp/decl2.c,v
retrieving revision 1.1.1.33
diff -u -p -r1.1.1.33 decl2.c
--- decl2.c	1998/05/09 20:35:27	1.1.1.33
+++ decl2.c	1998/05/10 00:28:21
@@ -1982,7 +1982,7 @@ constructor_name_full (thing)
   else if (IS_AGGR_TYPE_CODE (TREE_CODE (thing)))
     {
       if (TYPE_WAS_ANONYMOUS (thing) && TYPE_HAS_CONSTRUCTOR (thing))
-	thing = DECL_NAME (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (thing), 0));
+	thing = DECL_NAME (OVL_CURRENT (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (thing), 0)));
       else
 	thing = TYPE_NAME (thing);
     }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: An OVL_CURRENT patch?
  1998-05-09 17:36 An OVL_CURRENT patch? H.J. Lu
@ 1998-05-10  2:05 ` Martin von Loewis
  0 siblings, 0 replies; 2+ messages in thread
From: Martin von Loewis @ 1998-05-10  2:05 UTC (permalink / raw)
  To: hjl; +Cc: loewis, egcs

> Does this patch make any sense? 

When accessing the name of an overloaded function, you really want the
name of first function. So yes, the patch looks OK.

> Should we check all usages of TREE_VEC_ELT to see if OVL_CURRENT is
> needed?

There should be test cases for each change we make. I've included test
cases for your changes below.

Regards,
Martin

----------------------------------------------------------------
// Build don't link:
struct X{
  void f();        
};

struct Y:X{
  void f(int);
  void f();
  using X::f;       // ERROR - conflict
};                  // ERROR -
----------------------------------------------------------------
//Build don't link:
struct X{
  void i();     // ERROR -
  void i(int);
  int i;        // ERROR - conflict
};
----------------------------------------------------------------
// Build don't link:
struct A{
  A();
};

typedef struct {
  A i;
} S;

struct B: S{
  using S::S;        // ERROR - no such field
};

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-05-10  2:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-05-09 17:36 An OVL_CURRENT patch? H.J. Lu
1998-05-10  2:05 ` Martin von Loewis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).