mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Ensure, $eval and $evaltype, @unreachable() replaces $unreachable. <Type>.sizeof
This commit is contained in:
committed by
Christoffer Lerno
parent
4f4bc80953
commit
2802b2b96d
@@ -6,7 +6,7 @@ struct Foo
|
||||
long bar;
|
||||
}
|
||||
|
||||
private usize x = $sizeof(Foo);
|
||||
private usize x = Foo.sizeof;
|
||||
|
||||
private Foo foo1 = { 1, 2 };
|
||||
private Foo foo2 = { .foo = 2 };
|
||||
|
||||
@@ -7,7 +7,7 @@ struct Foo1 @packed @align(4)
|
||||
char foo;
|
||||
}
|
||||
|
||||
$assert($sizeof(Foo1) == 12);
|
||||
$assert(Foo1.sizeof == 12);
|
||||
Foo1 foo1 = { 1, 2 };
|
||||
|
||||
// <{ i8, i64, [3 x i8] }>
|
||||
@@ -17,7 +17,7 @@ struct Foo2 @packed @align(4)
|
||||
long bar;
|
||||
}
|
||||
|
||||
$assert($sizeof(Foo2) == 12);
|
||||
$assert(Foo2.sizeof == 12);
|
||||
Foo2 foo2 = { 1, 2 };
|
||||
|
||||
// <{ i8, i64, [7 x i8] }>
|
||||
@@ -28,7 +28,7 @@ struct Foo3 @packed @align(8)
|
||||
}
|
||||
|
||||
Foo3 foo3 = { 1, 2 };
|
||||
$assert($sizeof(Foo3) == 16);
|
||||
$assert(Foo3.sizeof == 16);
|
||||
|
||||
// <{ i8, i64 }>
|
||||
struct Foo4 @packed
|
||||
@@ -37,7 +37,7 @@ struct Foo4 @packed
|
||||
long bar;
|
||||
}
|
||||
|
||||
$assert($sizeof(Foo4) == 9);
|
||||
$assert(Foo4.sizeof == 9);
|
||||
Foo4 foo4 = { 1, 2 };
|
||||
|
||||
// { i32, [12 x i8], i8, [15 x i8] }
|
||||
@@ -47,7 +47,7 @@ struct Foo5
|
||||
ichar foo @align(16);
|
||||
}
|
||||
|
||||
$assert($sizeof(Foo5) == 32);
|
||||
$assert(Foo5.sizeof == 32);
|
||||
Foo5 foo5 = { 1, 2 };
|
||||
|
||||
fn int test5(ichar x)
|
||||
@@ -64,7 +64,7 @@ struct Foo6 @packed
|
||||
short c;
|
||||
}
|
||||
|
||||
$assert($sizeof(Foo6) == 8);
|
||||
$assert(Foo6.sizeof == 8);
|
||||
Foo6 foo6 = { 1, 2, 3 };
|
||||
|
||||
// #expect: struct2.ll
|
||||
|
||||
Reference in New Issue
Block a user