summaryrefslogtreecommitdiffstats
path: root/tests/front-end/struct-result-type.slang
diff options
context:
space:
mode:
Diffstat (limited to 'tests/front-end/struct-result-type.slang')
-rw-r--r--tests/front-end/struct-result-type.slang16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/front-end/struct-result-type.slang b/tests/front-end/struct-result-type.slang
new file mode 100644
index 000000000..35919a78a
--- /dev/null
+++ b/tests/front-end/struct-result-type.slang
@@ -0,0 +1,16 @@
+// Check that we can parse and check an anonymous struct declaration as function return type.
+
+//TEST:INTERPRET(filecheck=CHECK):
+
+module testa;
+
+func test(int a) -> struct{ int a,b; } {
+ return {a,2};
+}
+
+void main()
+{
+ let m = test(1);
+ // CHECK: 3
+ printf("%d\n", m.a + m.b);
+}