From 2e4cf9dce7d03df56ff3bfc923638cab9962b469 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Wed, 19 Dec 2001 11:52:59 +0000 Subject: [PATCH] re PR c++/90 (funny syntactical error message) cp: PR c++/90 * typeck.c (build_function_call_real): Use original function expression for errors. testsuite: * g++.dg/other/error1.C: New test. From-SVN: r48176 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/typeck.c | 7 ++++--- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/other/error1.C | 15 +++++++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/other/error1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index aea8e2282085..888c960f0035 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2001-12-19 Nathan Sidwell + + PR c++/90 + * typeck.c (build_function_call_real): Use original function + expression for errors. + 2001-12-18 Jason Merrill * class.c (add_method): Do compare 'this' quals when trying to match a diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index d5ba0840f08e..05c0711ec14e 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2964,6 +2964,7 @@ build_function_call_real (function, params, require_complete, flags) 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. */ @@ -2990,7 +2991,7 @@ build_function_call_real (function, params, require_complete, flags) /* 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 @@ -3011,7 +3012,7 @@ build_function_call_real (function, params, require_complete, flags) if (TYPE_PTRMEMFUNC_P (fntype)) { error ("must use .* or ->* to call pointer-to-member function in `%E (...)'", - function); + original); return error_mark_node; } @@ -3023,7 +3024,7 @@ build_function_call_real (function, params, require_complete, flags) || is_method || TREE_CODE (function) == TEMPLATE_ID_EXPR)) { - error ("`%E' cannot be used as a function", function); + error ("`%E' cannot be used as a function", original); return error_mark_node; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0d3656a99c88..b198da8b3d5a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-12-19 Nathan Sidwell + + * g++.dg/other/error1.C: New test. + Mon Dec 17 14:31:42 2001 Jeffrey A Law (law@redhat.com) * gcc.c-torture/execute/20011217-1.c: New test. diff --git a/gcc/testsuite/g++.dg/other/error1.C b/gcc/testsuite/g++.dg/other/error1.C new file mode 100644 index 000000000000..2fabd7ccf370 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/error1.C @@ -0,0 +1,15 @@ +// { dg-do compile } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 18 Dec 2001 + +// 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" "" } + } +}; -- 2.43.5