parser: fix `sizeof(int)` when used as call arg for external function (#5855)
parent
3583302ad4
commit
f6947d111b
|
@ -122,7 +122,10 @@ pub fn (mut p Parser) expr(precedence int) ast.Expr {
|
|||
pos: pos
|
||||
}
|
||||
} else {
|
||||
save_expr_mod := p.expr_mod
|
||||
p.expr_mod = ''
|
||||
sizeof_type := p.parse_type()
|
||||
p.expr_mod = save_expr_mod
|
||||
node = ast.SizeOf{
|
||||
is_type: true
|
||||
typ: sizeof_type
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
import math
|
||||
|
||||
fn test_sizeof() {
|
||||
r := math.f32_from_bits(sizeof(int))
|
||||
assert r > 5.6e-45 && r < 5.7e-45
|
||||
}
|
Loading…
Reference in New Issue