From 09e6cad37d4559f83cd27075f0c7c1524d502321 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Fri, 18 Jul 2025 22:11:12 +0300 Subject: add initial value handling + No type checking, shouldn't be too tricky to add in though --- tests/xok/superval.c | 24 ++++++++++++++++++++++++ tests/xok/val.c | 17 +++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tests/xok/superval.c create mode 100644 tests/xok/val.c (limited to 'tests') diff --git a/tests/xok/superval.c b/tests/xok/superval.c new file mode 100644 index 0000000..f6903c2 --- /dev/null +++ b/tests/xok/superval.c @@ -0,0 +1,24 @@ +#include + +typedef tmpl[](int v){ + int <>_ok() + { + return v; + } +}; + +typedef supertmpl[](int v) = tmpl[](v) { + int <>_superok() + { + return <>_ok(); + } +} + +typedef inst = supertmpl[](20); + +int main() +{ + int ok = inst_superok(); + if (ok == 20) + puts("OK"); +} diff --git a/tests/xok/val.c b/tests/xok/val.c new file mode 100644 index 0000000..9518d40 --- /dev/null +++ b/tests/xok/val.c @@ -0,0 +1,17 @@ +#include + +typedef tmpl[](int v){ + int <>_ok() + { + return v; + } +}; + +typedef inst = tmpl[](20); + +int main() +{ + int ok = inst_ok(); + if (ok == 20) + puts("OK"); +} -- cgit v1.2.3