blob: 0d6b27abe37ac85f09138f3e52348b1286d7447f (
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
34
35
36
37
38
39
40
41
42
43
44
45
|
export fn a() callconv(.Naked) noreturn {
var x: u32 = 10;
_ = &x;
const y: u32 = x + 10;
_ = y;
}
export fn b() callconv(.Naked) noreturn {
var x = @as(u32, 10);
_ = &x;
const y = x;
var z = y;
_ = &z;
}
export fn c() callconv(.Naked) noreturn {
const Foo = struct {
y: u32,
};
var x: Foo = .{ .y = 10 };
_ = &x;
}
export fn d() callconv(.Naked) noreturn {
const Foo = struct {
inline fn bar() void {
var x: u32 = 10;
_ = &x;
}
};
Foo.bar();
}
// error
// backend=stage2
//
// :2:5: error: local variable in naked function
// :10:5: error: local variable in naked function
// :23:5: error: local variable in naked function
// :30:13: error: local variable in naked function
// :35:12: note: called from here
|