This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/68615] New: Unhelpful location when missing a semi-colon on a function declaration at the end of a header
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 30 Nov 2015 11:34:34 +0000
- Subject: [Bug c++/68615] New: Unhelpful location when missing a semi-colon on a function declaration at the end of a header
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68615
Bug ID: 68615
Summary: Unhelpful location when missing a semi-colon on a
function declaration at the end of a header
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
# 1 "foo.cc"
# 1 "foo.h" 1
int f()
# 2 "foo.cc" 2
int main()
{
f();
}
This gives:
foo.cc:3:1: error: expected initializer before âintâ
int main()
^
We fixed the case where we're missing ; after a class definition so the error
location is the end of the class, but for this case we still give the location
as the start of main. Ideally it would be:
foo.h:1:7: error: expected â;â after function declaration
Related to Bug 56084, but that is about error recovery following the missing ;
and this is just about the location.