an ambiguity in c89 which will never be fixed 2026-08-10
i found some ambiguous wording in the c89(/c90) standard, where gcc and clang disagree on the interpretation. it concerns the behavior of implicit function declarations, which were removed in c99, so this was never disambiguated.
for those unaware: c89 has a cool "feature" where, if you try to call a function which doesn't exist, rather than erroring out, the function is implicitly declared as a function with unspecified parameters returning int.
more specifically: if the function in a call expression is a non-parenthesized identifier which isn't in scope, it's inserted into scope as an extern int () .
(a funny thing about this is that it means that seemingly superfluous parentheses around expressions affect semantics: f() inserts f into scope, but (f)() doesn't)
anyways, i'm gonna show you a fun edge case with this feature. but to build up to it, let's start simple. here's a declaration whose declarator declares itself:
int f(int [sizeof(f())]);
this declares a function with one parameter, which is an array (decayed to a pointer).
identifiers are inserted into scope after the declarator is completed. so when f() is called inside the array declarator, it isn't yet in scope, so it's declared as int () . the declarator then finishes, and f is redeclared with the compatible type int (int *) .
i'm now going to change the declaration by adding one character.
... continue reading