aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-04-24 22:31:53 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-04-24 22:31:53 -0400
commitfb2acaff067dd6b385de7f2bd2726bdfebbf841f (patch)
tree1dce5178adc5066eba68510d36baed06575aad0a /src
parent733c547a65b005338c89e3b6a6cb6e817bee632b (diff)
downloadzig-fb2acaff067dd6b385de7f2bd2726bdfebbf841f.tar.gz
zig-fb2acaff067dd6b385de7f2bd2726bdfebbf841f.zip
`@sizeOf` returns 0 for comptime types
This defines `@sizeOf` to be the runtime size of a type, which means that it is zero for types such as comptime_int, type, and (enum literal). See #2209
Diffstat (limited to 'src')
-rw-r--r--src/ir.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index f3435ccb17..62eadeb43f 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -16729,16 +16729,16 @@ static IrInstruction *ir_analyze_instruction_size_of(IrAnalyze *ira,
case ZigTypeIdUnreachable:
case ZigTypeIdUndefined:
case ZigTypeIdNull:
- case ZigTypeIdComptimeFloat:
- case ZigTypeIdComptimeInt:
- case ZigTypeIdEnumLiteral:
case ZigTypeIdBoundFn:
- case ZigTypeIdMetaType:
case ZigTypeIdArgTuple:
case ZigTypeIdOpaque:
- ir_add_error_node(ira, size_of_instruction->base.source_node,
+ ir_add_error_node(ira, type_value->source_node,
buf_sprintf("no size available for type '%s'", buf_ptr(&type_entry->name)));
return ira->codegen->invalid_instruction;
+ case ZigTypeIdMetaType:
+ case ZigTypeIdEnumLiteral:
+ case ZigTypeIdComptimeFloat:
+ case ZigTypeIdComptimeInt:
case ZigTypeIdVoid:
case ZigTypeIdBool:
case ZigTypeIdInt: