summaryrefslogtreecommitdiff
path: root/tests/sizeof.toc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/sizeof.toc')
-rw-r--r--tests/sizeof.toc17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/sizeof.toc b/tests/sizeof.toc
new file mode 100644
index 0000000..0bc806b
--- /dev/null
+++ b/tests/sizeof.toc
@@ -0,0 +1,17 @@
+#include "io.toc", io;
+
+Point3D ::= struct {
+ x, y, z: f32;
+}
+
+calculation ::= fn() int {
+ p: Point3D;
+ (#sizeof Point3D) * (#sizeof typeof p) * (sizeof Point3D) * (sizeof typeof p)
+ * (#alignof Point3D) * (#alignof typeof p) * (alignof Point3D) * (alignof typeof p)
+}
+
+main ::= fn() {
+ x ::= calculation();
+ io.puti(x);
+ io.puti(calculation());
+} \ No newline at end of file