aboutsummaryrefslogtreecommitdiff
path: root/tests/iii
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-22 13:59:48 +0000
committer_ov4 <ov4@ov4.org>2026-10-22 13:59:48 +0000
commitf694cc443ccc17a494cd195151882ab5e491bbb2 (patch)
tree4a74ec68a1406073c5d70d8a0a71b5d839e0c3ef /tests/iii
parent312a19c781da1c31ff1e3dc71c319663a8be9148 (diff)
feat(codegen): accept ^x of C values as variadic arguments
In a variadic EXTERN position, ^x now passes the address of x as a plain pointer when x has a C type or is a C struct, like C's f(n, &x). The address of a pseudocode-typed value keeps the "must be a C value" error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/iii')
-rw-r--r--tests/iii/extern-variadic-type/case.json4
-rw-r--r--tests/iii/extern-variadic-type/notes.md4
-rw-r--r--tests/iii/extern-variadic-type/program.cps2
3 files changed, 8 insertions, 2 deletions
diff --git a/tests/iii/extern-variadic-type/case.json b/tests/iii/extern-variadic-type/case.json
index 45fea44..a114299 100644
--- a/tests/iii/extern-variadic-type/case.json
+++ b/tests/iii/extern-variadic-type/case.json
@@ -3,6 +3,10 @@
{
"reason": "Variadic\\ argument\\ 2\\ to\\ printf\\ must\\ be\\ a\\ C\\ value",
"line": 5
+ },
+ {
+ "reason": "Variadic\\ argument\\ 2\\ to\\ printf\\ must\\ be\\ a\\ C\\ value",
+ "line": 7
}
]
}
diff --git a/tests/iii/extern-variadic-type/notes.md b/tests/iii/extern-variadic-type/notes.md
index 3de1d69..73456b5 100644
--- a/tests/iii/extern-variadic-type/notes.md
+++ b/tests/iii/extern-variadic-type/notes.md
@@ -1,5 +1,5 @@
# extern-variadic-type
-Compiler extension: variadic EXTERN arguments must be C values; the INTEGER literal 1 is not cast.
+Compiler extension: variadic EXTERN arguments must be C values; the INTEGER literal 1 is not cast, and ^I points to an INTEGER rather than a C value.
-Require exit 1 and the cause on the call line.
+Require exit 1 and each cause on its call line.
diff --git a/tests/iii/extern-variadic-type/program.cps b/tests/iii/extern-variadic-type/program.cps
index 23f1fe9..0a967f3 100644
--- a/tests/iii/extern-variadic-type/program.cps
+++ b/tests/iii/extern-variadic-type/program.cps
@@ -3,3 +3,5 @@ INCLUDE_OBJ "__libc"
EXTERN "C" EXTERN_FUNCTION printf(C_STRING, ...) RETURNS C_INT
DECLARE N : C_INT
N <- printf((C_STRING)"%d", 1)
+DECLARE I : INTEGER
+N <- printf((C_STRING)"%p", ^I)