]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/90 (funny syntactical error message)
authorNathan Sidwell <nathan@codesourcery.com>
Wed, 19 Dec 2001 11:52:59 +0000 (11:52 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Wed, 19 Dec 2001 11:52:59 +0000 (11:52 +0000)
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
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/error1.C [new file with mode: 0644]

index aea8e22820859d5be4439f4bc2f5c6a602449c49..888c960f00356ed9f3e58c8d469d94e1e740dbe6 100644 (file)
@@ -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
index d5ba0840f08ec4fabade82c01b169a43b59b47ad..05c0711ec14eb7984c3c6761f8e967e9afe06298 100644 (file)
@@ -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;
     }
 
index 0d3656a99c88807a002ac8c1226dfb6fa8cefc3f..b198da8b3d5a69c0c7566aaa5cd37e4bd3d01e80 100644 (file)
@@ -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 (file)
index 0000000..2fabd7c
--- /dev/null
@@ -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" "" }
+  }
+};