-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Labels
Description
I've found this kind of code which is accepted by Clang and GCC, but not by lang-c.
int fn() {
int ifn() {
return 5;
}
return ifn();
}
fn is a function having an internal function, named ifn. ifn is only in scope inside the body of fn. This is not standard C, but a GNU extension. I don't think it's in ANSI C or ISO C99, or K&R, or anything like that. So I am not sure if we want or need to accept this kind of code in lang-c.
I'm getting this error message:
SyntaxError(SyntaxError { source: "# 0 \"c/fninfn.c\"\n# 0 \"<built-in>\"\n# 0 \"<command-line>\"\n# 1 \"/usr/include/stdc-predef.h\" 1 3 4\n# 0 \"<command-line>\" 2\n# 1 \"c/fninfn.c\"\nint fn() {\n int ifn() {\n return 5;\n }\n return ifn();\n}\n", line: 8, column: 12, offset: 156, expected: {";", "asm", "(", "[", ",", "="} })
What do you think?