commit 6d7c97261fba09e32ae624b3c582bceb5f3cd14d parent d37ddf24e923eb2c2d63d881d7ebe46ea1ba4cdb Author: Ryan Sepassi <rsepassi@gmail.com> Date: Sun, 26 Apr 2026 22:44:03 -0700 cc tests: multi-fn TU with forward reference (§J.3) main calls helper before helper is defined; the prototype `int helper(int x);` binds an extern fn sym up-front so parse-primary finds it. Locks in the forward-decl path. Diffstat:
| A | tests/cc-parse/69-multi-fn.c | | | 11 | +++++++++++ |
| A | tests/cc-parse/69-multi-fn.expected-exit | | | 1 | + |
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/tests/cc-parse/69-multi-fn.c b/tests/cc-parse/69-multi-fn.c @@ -0,0 +1,11 @@ +/* §J.3 — multi-function TU with forward references. + * main calls helper before helper is defined. */ +int helper(int x); + +int main(void) { + return helper(20) + helper(15); /* (20+1) + (15+1) = 37 */ +} + +int helper(int x) { + return x + 1; +} diff --git a/tests/cc-parse/69-multi-fn.expected-exit b/tests/cc-parse/69-multi-fn.expected-exit @@ -0,0 +1 @@ +37