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]
Other format: [Raw text]

[C++ PATCH]: Fix PR 90


Hi,
I've installed this obvious fix for PR 90, we were saying
	'(this + 160)'
rather than the more sensible
	'this->Foo::bar'

built & tested on i686-pc-linux-gnu.

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
2001-12-18  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/90
	* typeck.c (build_function_call_real): Use original function
	expression for errors.

Index: cp/typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/typeck.c,v
retrieving revision 1.376
diff -c -3 -p -r1.376 typeck.c
*** typeck.c	2001/12/18 03:35:39	1.376
--- typeck.c	2001/12/18 20:01:07
*************** build_function_call_real (function, para
*** 2964,2969 ****
--- 2964,2970 ----
    tree result;
    tree name = NULL_TREE, assembler_name = NULL_TREE;
    int is_method;
+   tree original = function;
  
    /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
       Strip such NOP_EXPRs, since FUNCTION is used in non-lvalue context.  */
*************** build_function_call_real (function, para
*** 2990,2996 ****
        /* Differs from default_conversion by not setting TREE_ADDRESSABLE
  	 (because calling an inline function does not mean the function
  	 needs to be separately compiled).  */
! 
        if (DECL_INLINE (function))
  	function = inline_conversion (function);
        else
--- 2991,2997 ----
        /* Differs from default_conversion by not setting TREE_ADDRESSABLE
  	 (because calling an inline function does not mean the function
  	 needs to be separately compiled).  */
!       
        if (DECL_INLINE (function))
  	function = inline_conversion (function);
        else
*************** build_function_call_real (function, para
*** 3011,3017 ****
    if (TYPE_PTRMEMFUNC_P (fntype))
      {
        error ("must use .* or ->* to call pointer-to-member function in `%E (...)'",
! 		function);
        return error_mark_node;
      }
  
--- 3012,3018 ----
    if (TYPE_PTRMEMFUNC_P (fntype))
      {
        error ("must use .* or ->* to call pointer-to-member function in `%E (...)'",
! 		original);
        return error_mark_node;
      }
  
*************** build_function_call_real (function, para
*** 3023,3029 ****
  	|| is_method
  	|| TREE_CODE (function) == TEMPLATE_ID_EXPR))
      {
!       error ("`%E' cannot be used as a function", function);
        return error_mark_node;
      }
  
--- 3024,3030 ----
  	|| is_method
  	|| TREE_CODE (function) == TEMPLATE_ID_EXPR))
      {
!       error ("`%E' cannot be used as a function", original);
        return error_mark_node;
      }
  
// { dg-do compile }

// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 18 Dec 2001 <nathan@nathan@codesourcery.com>

// PR 90, stupid error message `(this + 160)'

class foo {
  public:
  int fudge[40];
  int bar [40];
  inline int access(int i) {
    return bar(i);  // { dg-error "`this->foo::bar' cannot" "" }
  }
};

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