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

            Bug ID: 118625
           Summary: Ironic fix-it hint when the right parenthesis of an
                    assert macro is forgotten
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xry111 at gcc dot gnu.org
  Target Milestone: ---

#include <assert.h>

int main()
{
        assert(1;
}

t1.c: In function 'main':
t1.c:6:2: error: unterminated argument list invoking macro "assert"
    6 | }
      |  ^
t1.c:5:9: error: 'assert' undeclared (first use in this function)
    5 |         assert(1;
      |         ^~~~~~
t1.c:2:1: note: 'assert' is defined in header '<assert.h>'; this is probably
fixable by adding '#include <assert.h>'
    1 | #include <assert.h>
  +++ |+#include <assert.h>
    2 | 
t1.c:5:9: note: each undeclared identifier is reported only once for each
function it appears in
    5 |         assert(1;
      |         ^~~~~~
t1.c:5:15: error: expected ';' at end of input
    5 |         assert(1;
      |               ^
      |               ;
    6 | }
t1.c:5:9: error: expected declaration or statement at end of input
    5 |         assert(1;
      |         ^~~~~~

The fix-it hint is really ironic.

Reply via email to