C++ PATCH for missed error

Mark Mitchell mark@codesourcery.com
Wed Apr 7 21:09:00 GMT 1999


Here's another minor tweak, simplifying things ever so slightly.

-- 
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

1999-04-07  Mark Mitchell  <mark@codesourcery.com>

	* init.c (build_offset_ref): Don't build yet another weird data
	structure to describe overloaded functions.

Index: testsuite/g++.old-deja/g++.other/sizeof1.C
===================================================================
RCS file: sizeof1.C
diff -N sizeof1.C
*** /dev/null	Sat Dec  5 20:30:03 1998
--- sizeof1.C	Wed Apr  7 20:24:24 1999
***************
*** 0 ****
--- 1,12 ----
+ // Build don't link:
+ // Origin: Jason Merrill <jason@cygnus.com>
+ 
+ struct X {
+   int f ();
+   int f (int);
+ };
+ 
+ void f(int i)
+ {
+   i = sizeof(X::f); // ERROR - cannot take sizeof a member function
+ }
Index: cp/init.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/init.c,v
retrieving revision 1.93
diff -c -p -r1.93 init.c
*** init.c	1999/04/06 14:38:04	1.93
--- init.c	1999/04/08 03:24:36
*************** build_offset_ref (type, name)
*** 1572,1578 ****
  
    /* A lot of this logic is now handled in lookup_field and
       lookup_fnfield.  */
!   if (member && TREE_CODE (member) == TREE_LIST)
      {
        /* Go from the TREE_BASELINK to the member function info.  */
        tree fnfields = member;
--- 1572,1578 ----
  
    /* A lot of this logic is now handled in lookup_field and
       lookup_fnfield.  */
!   if (member && BASELINK_P (member))
      {
        /* Go from the TREE_BASELINK to the member function info.  */
        tree fnfields = member;
*************** build_offset_ref (type, name)
*** 1627,1635 ****
  	  && ! allocation_temporary_p ())
  	fnfields = copy_list (fnfields);
  
!       t = build_tree_list (error_mark_node, fnfields);
!       TREE_TYPE (t) = build_offset_type (type, unknown_type_node);
!       return t;
      }
  
    t = member;
--- 1627,1634 ----
  	  && ! allocation_temporary_p ())
  	fnfields = copy_list (fnfields);
  
!       TREE_TYPE (fnfields) = build_offset_type (type, unknown_type_node);
!       return fnfields;
      }
  
    t = member;



More information about the Gcc-patches mailing list