This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/81610] New: bogus fix-it hint for a call to an undeclared function: for
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 29 Jul 2017 00:26:15 +0000
- Subject: [Bug c++/81610] New: bogus fix-it hint for a call to an undeclared function: for
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81610
Bug ID: 81610
Summary: bogus fix-it hint for a call to an undeclared
function: for
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
When G++ detects a call to an undeclared function it prints an error message
which may include a fix-it hint with a suggestion for an alternative. That's
helpful when the alternative is a function with a similar name. It's not
helpful when the alternative is not a function that can be called as in the
case below where the suggestion is obviously bogus. G++ should avoid
suggesting symbols that cannot be used in the context in which the original
name is used.
$ cat t.C && gcc -S -Wall -Wextra -Wpedantic t.C
void f (void *p)
{
forget (p);
}
t.C: In function ‘void f(void*)’:
t.C:3:3: error: ‘forget’ was not declared in this scope
forget (p);
^~~~~~
t.C:3:3: note: suggested alternative: ‘for’
forget (p);
^~~~~~
for