This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[C++ PATCH] fix bug 382


Hi,
I've installed this patch which fixes bug 382. We failed to contemplate
a TEMPLATE_ID_EXPR might implicitly have its address taken.

built & tested on i686-pc-linux-gnu, approved by Mark.

nathan
-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2000-09-04  Nathan Sidwell  <nathan@codesourcery.com>

	* init.c (resolve_offset_ref): Deal with TEMPLATE_ID_EXPR.

Index: cp/init.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/init.c,v
retrieving revision 1.213
diff -c -3 -p -r1.213 init.c
*** init.c	2000/08/18 09:31:11	1.213
--- init.c	2000/09/04 11:16:22
*************** resolve_offset_ref (exp)
*** 1812,1818 ****
        base = current_class_ref;
      }
  
!   if (BASELINK_P (member))
      return build_unary_op (ADDR_EXPR, exp, 0);
    
    if (TREE_CODE (TREE_TYPE (member)) == METHOD_TYPE)
--- 1812,1818 ----
        base = current_class_ref;
      }
  
!   if (BASELINK_P (member) || TREE_CODE (member) == TEMPLATE_ID_EXPR)
      return build_unary_op (ADDR_EXPR, exp, 0);
    
    if (TREE_CODE (TREE_TYPE (member)) == METHOD_TYPE)
*************** resolve_offset_ref (exp)
*** 1824,1830 ****
        
        return build_unary_op (ADDR_EXPR, exp, 0);
      }
! 
    if ((TREE_CODE (member) == VAR_DECL
         && ! TYPE_PTRMEMFUNC_P (TREE_TYPE (member))
         && ! TYPE_PTRMEM_P (TREE_TYPE (member)))
--- 1824,1830 ----
        
        return build_unary_op (ADDR_EXPR, exp, 0);
      }
!   
    if ((TREE_CODE (member) == VAR_DECL
         && ! TYPE_PTRMEMFUNC_P (TREE_TYPE (member))
         && ! TYPE_PTRMEM_P (TREE_TYPE (member)))
// Build don't link:
// 
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 11 Aug 2000 <nathan@codesourcery.com>

// bug 382. We ICE'd rather than decay to an address.

struct A {
template <class T> static void f(T) {}
};
void (*h)(int) = A::f<int>;
void (*i)(int) = &A::f<int>;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]