mirror of
https://github.com/ziglang/zig.git
synced 2025-01-09 03:32:48 +00:00
parent
9b91c76088
commit
175893913d
@ -4554,6 +4554,7 @@ static void define_builtin_types(CodeGen *g) {
|
||||
{
|
||||
TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdUndefLit);
|
||||
buf_init_from_str(&entry->name, "(undefined)");
|
||||
entry->zero_bits = true;
|
||||
g->builtin_types.entry_undef = entry;
|
||||
}
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
const assert = @import("std").debug.assert;
|
||||
const mem = @import("std").mem;
|
||||
|
||||
fn initStaticArray() -> [10]i32 {
|
||||
var array: [10]i32 = undefined;
|
||||
@ -60,3 +61,8 @@ test "assign undefined to struct with method" {
|
||||
assert(foo.x == 3);
|
||||
}
|
||||
}
|
||||
|
||||
test "type name of undefined" {
|
||||
const x = undefined;
|
||||
assert(mem.eql(u8, @typeName(@typeOf(x)), "(undefined)"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user