aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-07-23 18:35:18 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2025-07-23 18:35:18 +0300
commitf2fc8861fe241683ccc4bf026fbeeefe6ba1e04e (patch)
treea68a8d8ffa6d47c1ddd923d2dc9efd3777efcb0f /tests
parent09e6cad37d4559f83cd27075f0c7c1524d502321 (diff)
downloadngc-master.tar.gz
ngc-master.zip
check const types with static_assertHEADmaster
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile2
-rw-r--r--tests/xfail/Makefile15
-rw-r--r--tests/xfail/val.c18
3 files changed, 35 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile
index bcc91d3..1041e61 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,5 +1,7 @@
all:
$(MAKE) -C xok
+ $(MAKE) -C xfail
clean:
$(MAKE) -C xok clean
+ $(MAKE) -C xfail clean
diff --git a/tests/xfail/Makefile b/tests/xfail/Makefile
new file mode 100644
index 0000000..b38feae
--- /dev/null
+++ b/tests/xfail/Makefile
@@ -0,0 +1,15 @@
+FILES != echo *.c
+TARGETS := $(FILES:%.c=build/%)
+
+all: $(TARGETS)
+
+build/%: %.c ../../ngc1
+ @mkdir -p build
+ @gcc -E $< -o $@.i
+ @(../../ngc1 $@.i > $@.c 2>/dev/null && gcc $@.c -o $@ 2>/dev/null) \
+ && echo "FAIL $@" \
+ || echo "XFAIL $@"
+
+.PHONY: clean
+clean:
+ $(RM) -rf build
diff --git a/tests/xfail/val.c b/tests/xfail/val.c
new file mode 100644
index 0000000..d231a4a
--- /dev/null
+++ b/tests/xfail/val.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+typedef tmpl[](int v){
+ int <>_ok()
+ {
+ return v;
+ }
+};
+
+/* float vs int, should fail */
+typedef inst = tmpl[](20.0);
+
+int main()
+{
+ int ok = inst_ok();
+ if (ok == 20)
+ puts("OK");
+}