[cfe-dev] failed gcc nested function

Shang Yu yusunn at gmail.com
Tue Aug 21 07:14:53 PDT 2012


Hi dear all,
The following code will fail in clang:

void f (int (*p) (void));
void g (int i)
{
  int nestedfunc (void) { return i; }
  f (nestedfunc);
}

compile with clang -S test.c got following message
test.c:4:24: error: expected ';' at end of declaration
  int nestedfunc (void) { return i; }
                       ^
                       ;
1 error generated.
 but gcc -S test.c will be OK.
Many thanks!



More information about the cfe-dev mailing list