aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2001-12-19 11:52:59 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2001-12-19 11:52:59 +0000
commit2e4cf9dce7d03df56ff3bfc923638cab9962b469 (patch)
tree3b9a73f1002332536c2cbe5d68ebb323ccc305a5
parentb2c16b03be8c341e73afff5e9ae13fdca57386e9 (diff)
downloadgcc-2e4cf9dce7d03df56ff3bfc923638cab9962b469.zip
gcc-2e4cf9dce7d03df56ff3bfc923638cab9962b469.tar.gz
gcc-2e4cf9dce7d03df56ff3bfc923638cab9962b469.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/typeck.c7
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/other/error1.C15
4 files changed, 29 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index aea8e22..888c960 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2001-12-19 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/90
+ * typeck.c (build_function_call_real): Use original function
+ expression for errors.
+
2001-12-18 Jason Merrill <jason@redhat.com>
* 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 d5ba084..05c0711 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 0d3656a..b198da8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2001-12-19 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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 0000000..2fabd7c
--- /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 <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" "" }
+ }
+};