This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/68615] New: Unhelpful location when missing a semi-colon on a function declaration at the end of a header


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]