aboutsummaryrefslogtreecommitdiff
path: root/compiler/tests/backend/pointer_to_literal.good
blob: 2bdea4ee0094362c6655d43da93515cd8b79e8cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

int^ ip = @0;
bool^ bp = @:false;
int#[3]^ ap = @[1,2,3];
(int x, bool b)^ sp = @(123, :true);
()^ ep = @();

(int^ np)^ nested1 = @(@0,);
(int^#[3]^ np)^ nested2 = @(@[@123, @456, @789],);


// This is not a pointer to literal
// No temporaries should be used
int i = 1;
int^ normalptr = @i;


linkname "f" () f() {
    int^ ip = @0;
    bool^ bp = @:false;
    int#[3]^ ap = @[1,2,3];
    (int x, bool b)^ sp = @(123, :true);
    ()^ ep = @();

    (int^ np)^ nested1 = @(@0,);
    (int^#[3]^ np)^ nested2 = @(@[@123, @456, @789],);


    // This is not a pointer to literal
    // No temporaries should be used
    int i = 1;
    int^ normalptr = @i;
}