define an empty lambda as an empty function
A lifted function with no body was a declaration of one, and nothing defined it, so the program did not link.
This commit is contained in:
@@ -441,6 +441,13 @@
|
||||
(test-assert "and its code names it, a definition needing one before C23"
|
||||
(emits? (in-fn "(var c (closure ((int) (int)) int) (closure ((int) (b int)) int () (return b)))")
|
||||
"int ƛu0, int b)"))
|
||||
;; a lifted function with no body was a declaration of one, and
|
||||
;; nothing defined it
|
||||
(test-assert "an empty lambda is an empty function"
|
||||
(emits? "(fn f () void (var g (fn () void) (lambda () void)))"
|
||||
"static void λ0_f (void) {}"))
|
||||
(test-assert "so is an empty closure's code"
|
||||
(emits? (in-fn "(var c (closure () void) (closure () void ()))") "(void * ƛe) {}"))
|
||||
;; the call helper would have to forward the rest, which C cannot
|
||||
(test-assert "a closure cannot be variadic"
|
||||
(reports? (in-fn "(var c _ (closure ((n int) ...) int () (return n)))")
|
||||
|
||||
Reference in New Issue
Block a user