This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/82373] New: syntax error in error message
- From: "drepper.fsp+rhbz at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 30 Sep 2017 10:27:31 +0000
- Subject: [Bug c++/82373] New: syntax error in error message
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82373
Bug ID: 82373
Summary: syntax error in error message
Product: gcc
Version: 7.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: drepper.fsp+rhbz at gmail dot com
Target Milestone: ---
Compiling the invalid code at the bottom produces the following message:
y.cc: In function ‘auto bar::foo(int))(int)’:
y.cc:7:12: error: inconsistent deduction for auto return type: ‘int (*)(int)’
and then ‘std::nullptr_t’
return nullptr;
^~~~~~~
The function name is wrong. The parameter list of the inferred return type
should not be printed.
auto bar::foo(int)
The correct form would have (* before the function name:
auto (*bar::foo(int))(int)
^^
But then the 'auto' must be replaced as well. But this is wrong since it does
not correspond to a function in the source.
namespace bar {
int(*fp)(int);
auto foo(int a)
{
if (a)
return fp;
return nullptr;
}
}