summaryrefslogtreecommitdiffstats
path: root/tests/front-end/struct-result-type.slang
blob: 35919a78a2efa040b049eb3b65724efaab8d9cb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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);
}