aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index da94dd4bcd..a5f8b85e22 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -3762,7 +3762,6 @@ static LLVMValueRef pack_const_int(CodeGen *g, LLVMTypeRef big_int_type_ref, Con
case TypeTableEntryIdNullLit:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdPureError:
- case TypeTableEntryIdEnum:
case TypeTableEntryIdEnumTag:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBlock:
@@ -3773,6 +3772,13 @@ static LLVMValueRef pack_const_int(CodeGen *g, LLVMTypeRef big_int_type_ref, Con
zig_unreachable();
case TypeTableEntryIdBool:
return LLVMConstInt(big_int_type_ref, const_val->data.x_bool ? 1 : 0, false);
+ case TypeTableEntryIdEnum:
+ {
+ assert(type_entry->data.enumeration.gen_field_count == 0);
+ assert(type_entry->data.enumeration.decl_node->data.container_decl.init_arg_expr != nullptr);
+ LLVMValueRef int_val = gen_const_val(g, const_val);
+ return LLVMConstZExt(int_val, big_int_type_ref);
+ }
case TypeTableEntryIdInt:
{
LLVMValueRef int_val = gen_const_val(g, const_val);
@@ -3814,6 +3820,7 @@ static LLVMValueRef pack_const_int(CodeGen *g, LLVMTypeRef big_int_type_ref, Con
}
return val;
}
+
}
zig_unreachable();
}