This is the mail archive of the gcc-bugs@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]

Re: egcs-2.91.47 c++ new parsing bug?, function pointer


> bg.ii: In method 'void KBackground::apply()':
> bg.ii:314: warning: taking address of temporary
> bg.ii:314:  sorry, Koenig lookup fot 'target_expr' of type 'QPixmap' failed
> bg.ii:314: confused by earlier errors, bailing out

Thanks for the test case, I've added a smaller version of it as
g++.ns/koenig6.C. Here is the patch.

Martin

1998-07-15  Martin von Löwis  <loewis@informatik.hu-berlin.de>

	* decl2.c (arg_assoc): Loop over both switches.

Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.99
diff -c -p -r1.99 decl2.c
*** decl2.c	1998/07/14 23:34:17	1.99
--- decl2.c	1998/07/15 07:33:11
*************** arg_assoc (k, n)
*** 4307,4373 ****
       struct arg_lookup* k;
       tree n;
  {
!   switch (TREE_CODE_CLASS (TREE_CODE (n)))
      {
!     case 't':
!       return arg_assoc_type (k, n);
!     case 'c':
!     case '1':
!     case '2':
!     case '<':
!     case 'r':
!       return arg_assoc_type (k, TREE_TYPE (n));
!     case 'e':
!       switch (TREE_CODE (n))
  	{
! 	case ADDR_EXPR:
! 	  /* special processing */
! 	  break;
  	default:
  	  return arg_assoc_type (k, TREE_TYPE (n));
  	}
-     default:
-       break;
      }
- 
-   while (n)
-     switch (TREE_CODE (n))
-       {
-       case CONST_DECL: /* 'd' */
-       case VAR_DECL:
-       case PARM_DECL:
-       case RESULT_DECL:
- 	return arg_assoc_type (k, TREE_TYPE (n));
-       case ADDR_EXPR: /* 'e' */
- 	/* We can't use the TREE_TYPE, as the type of an overloaded function
- 	   will be useless here. */
- 	n = TREE_OPERAND (n, 0);
- 	continue;
-       case OVERLOAD:  /* 'x' */
- 	if (arg_assoc (k, OVL_CURRENT (n)))
- 	  return 1;
- 	n = OVL_NEXT (n);
- 	continue;
-       case TREE_LIST: /* 'x' */
- 	/* XXX Overloaded member, should get an OVERLOAD directly, here. */
- 	n = TREE_VALUE (n);
- 	continue;
-       case FUNCTION_DECL: /* 'd' */
- 	if (arg_assoc_args (k, TYPE_ARG_TYPES (TREE_TYPE (n))))
- 	  return 1;	
- 	return 0;
-       case TEMPLATE_DECL:
-         /* XXX Type of a function template in the context of Koenig lookup?
-            Assume that template parameters are non-deduced for the moment. */
-         n = DECL_RESULT (n);
-         continue;
-       case ERROR_MARK:
-         return 0;
-       default:
- 	cp_error ("sorry, Koenig lookup for `%s' of type `%T' failed",
- 		  tree_code_name [(int)TREE_CODE (n)], TREE_TYPE (n));
- 	my_friendly_abort (391);
-       }
    return 0;
  }
  
--- 4307,4375 ----
       struct arg_lookup* k;
       tree n;
  {
!   while (n)
      {
!       switch (TREE_CODE_CLASS (TREE_CODE (n)))
  	{
! 	case 't':
! 	  return arg_assoc_type (k, n);
! 	case 'c':
! 	case '1':
! 	case '2':
! 	case '<':
! 	case 'r':
! 	  return arg_assoc_type (k, TREE_TYPE (n));
! 	case 'e':
! 	  switch (TREE_CODE (n))
! 	    {
! 	    case ADDR_EXPR:
! 	      /* special processing */
! 	      break;
! 	    default:
! 	      return arg_assoc_type (k, TREE_TYPE (n));
! 	    }
  	default:
+ 	  break;
+ 	}
+ 
+       switch (TREE_CODE (n))
+ 	{
+ 	case CONST_DECL: /* 'd' */
+ 	case VAR_DECL:
+ 	case PARM_DECL:
+ 	case RESULT_DECL:
  	  return arg_assoc_type (k, TREE_TYPE (n));
+ 	case ADDR_EXPR: /* 'e' */
+ 	  /* We can't use the TREE_TYPE, as the type of an overloaded function
+ 	     will be useless here. */
+ 	  n = TREE_OPERAND (n, 0);
+ 	  continue;
+ 	case OVERLOAD:  /* 'x' */
+ 	  if (arg_assoc (k, OVL_CURRENT (n)))
+ 	    return 1;
+ 	  n = OVL_NEXT (n);
+ 	  continue;
+ 	case TREE_LIST: /* 'x' */
+ 	  /* XXX Overloaded member, should get an OVERLOAD directly, here. */
+ 	  n = TREE_VALUE (n);
+ 	  continue;
+ 	case FUNCTION_DECL: /* 'd' */
+ 	  if (arg_assoc_args (k, TYPE_ARG_TYPES (TREE_TYPE (n))))
+ 	    return 1;	
+ 	  return 0;
+ 	case TEMPLATE_DECL:
+ 	  /* XXX Type of a function template in the context of Koenig lookup?
+ 	     Assume that template parameters are non-deduced for the moment. */
+ 	  n = DECL_RESULT (n);
+ 	  continue;
+ 	case ERROR_MARK:
+ 	  return 0;
+ 	default:
+ 	  cp_error ("sorry, Koenig lookup for `%s' of type `%T' failed",
+ 		    tree_code_name [(int)TREE_CODE (n)], TREE_TYPE (n));
+ 	  my_friendly_abort (391);
  	}
      }
    return 0;
  }
  



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