[Bug c++/65137] wrong line for missing semicolon after expression

dmalcolm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 15 19:52:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65137

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |dmalcolm at gcc dot gnu.org
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |dmalcolm at gcc dot gnu.org

--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
As of gcc 8, we now emit the diagnostic at the correct location:

C:

/tmp/test.c: In function ‘foo’:
/tmp/test.c:3:6: error: expected ‘;’ before ‘return’
   a++
      ^
      ;
   return 0;
   ~~~~~~

C++:

/tmp/test.c: In function ‘int foo(int)’:
/tmp/test.c:3:6: error: expected ‘;’ before ‘return’
   a++
      ^
      ;
   return 0;
   ~~~~~~
/tmp/test.c:5:1: warning: no return statement in function returning non-void
[-Wreturn-type]
 }
 ^


More information about the Gcc-bugs mailing list