authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2019-11-04 23:31:38+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-11-05 12:05:01-05:00
log71e209521a0675a3ec06aba133ce8837e2ee9806
treeb08b47e6608c816ae5848c2075e9d1f886e608ee
parent4e9ab0306ac84227bff1188bbf4d65a1ae5255d9

Mark type fields as CT

Fixes #3276

2 files changed, 9 insertions(+), 0 deletions(-)

src/ir.cpp+2
......@@ -20405,6 +20405,7 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInstruction *source_instr
2040520405 bigint_init_unsigned(&inner_fields[2].data.x_union.tag, 1);
2040620406
2040720407 ConstExprValue *payload = create_const_vals(1);
20408 payload->special = ConstValSpecialStatic;
2040820409 payload->type = ira->codegen->builtin_types.entry_type;
2040920410 payload->data.x_type = var->const_value->type;
2041020411
......@@ -20525,6 +20526,7 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInstruction *source_instr
2052520526 bigint_init_unsigned(&inner_fields[2].data.x_union.tag, 0);
2052620527
2052720528 ConstExprValue *payload = create_const_vals(1);
20529 payload->special = ConstValSpecialStatic;
2052820530 payload->type = ira->codegen->builtin_types.entry_type;
2052920531 payload->data.x_type = type_entry;
2053020532
test/stage1/behavior/type_info.zig+7
......@@ -339,3 +339,10 @@ test "type info: extern fns with and without lib names" {
339339 }
340340 }
341341}
342
343test "data field is a compile-time value" {
344 const S = struct {
345 const Bar = isize(-1);
346 };
347 comptime expect(@typeInfo(S).Struct.decls[0].data.Var == isize);
348}