mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: fix sizeof(int)
when used as call arg for external function (#5855)
This commit is contained in:
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
|
||||
|
6
vlib/v/tests/sizeof_test.v
Normal file
6
vlib/v/tests/sizeof_test.v
Normal file
@ -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
Block a user