mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: parse non-identifier expressions for sizeof too (#7781)
This commit is contained in:
@@ -1,6 +1,17 @@
|
||||
import math
|
||||
|
||||
fn test_sizeof() {
|
||||
struct S1 {
|
||||
i voidptr
|
||||
}
|
||||
|
||||
fn test_math_sizeof() {
|
||||
r := math.f32_from_bits(sizeof(int))
|
||||
assert r > 5.6e-45 && r < 5.7e-45
|
||||
}
|
||||
|
||||
fn test_sizeof() {
|
||||
// depends on compiler
|
||||
assert sizeof(`€`) in [u32(2), 4]
|
||||
// depends on -m32/64
|
||||
assert sizeof(S1) in [u32(4), 8]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user