Closed mzoz closed 10 months ago
When I do it, I get:
declare foo as function returning integer
(which is also wrong).
No worries Paul, it's indeed syntactically correct, but violates some misc constrain, I've just found this footnote on c standard: "A function declarator shall not specify a return type that is a function type or an array type." on page 118 https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
great work by the way, have a nice day!
Why did you close it? It's still wrong.
I tried a few obvious things, but none worked (without breaking other tests). It might take a while.
The fix is kind of hack-ish. The code between adding functions and adding arrays is similar. I suspect that there's a more elegant fix waiting to be discovered that also unifies the code between arrays and functions.
For example
int foo()()()
is comprehended as "declare foo as function returning function returning function returning int", but it's an invalid declarator and won't pass compilation, please help thanks!