[Bug c++/79551] Better caret position for not declared errors

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Feb 17 00:23:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79551

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-02-17
                 CC|                            |msebor at gcc dot gnu.org
            Summary|Better carouse position for |Better caret position for
                   |not declared errors         |not declared errors
     Ever confirmed|0                           |1

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed.

I can reproduce the error and have seen this problem in many diagnostics issued
by the C++ front end and I suspect there is a bug about it already (bug 79531 I
just happened to look at points out this very problem but in a different
error).

But when trying to isolate it to a small test case (below) the caret points at
the right location.  (I assume you did mean caret in the subject so I fixed the
typo).  So there must be something more involved going on in predict.c.

$ cat t.C && gcc -S -Wall -Wextra -Wpedantic t.C
void foo (int x)
{
  debug_tree (x);

  foobar (x);
}

t.C: In function ‘void foo(int)’:
t.C:3:3: error: ‘debug_tree’ was not declared in this scope
   debug_tree (x);
   ^~~~~~~~~~
t.C:5:3: error: ‘foobar’ was not declared in this scope
   foobar (x);
   ^~~~~~
t.C:5:3: note: suggested alternative: ‘foo’
   foobar (x);
   ^~~~~~
   foo


More information about the Gcc-bugs mailing list