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.

Reply via email to