| ... | ... | @@ -5886,9 +5886,16 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const c |
| 5886 | 5886 | case ZigTypeIdEnum: |
| 5887 | 5887 | return bigint_to_llvm_const(type_entry->type_ref, &const_val->data.x_enum_tag); |
| 5888 | 5888 | case ZigTypeIdFn: |
| 5889 | | assert(const_val->data.x_ptr.special == ConstPtrSpecialFunction); |
| 5890 | | assert(const_val->data.x_ptr.mut == ConstPtrMutComptimeConst); |
| 5891 | | return fn_llvm_value(g, const_val->data.x_ptr.data.fn.fn_entry); |
| 5889 | if (const_val->data.x_ptr.special == ConstPtrSpecialFunction) { |
| 5890 | assert(const_val->data.x_ptr.mut == ConstPtrMutComptimeConst); |
| 5891 | return fn_llvm_value(g, const_val->data.x_ptr.data.fn.fn_entry); |
| 5892 | } else if (const_val->data.x_ptr.special == ConstPtrSpecialHardCodedAddr) { |
| 5893 | LLVMTypeRef usize_type_ref = g->builtin_types.entry_usize->type_ref; |
| 5894 | uint64_t addr = const_val->data.x_ptr.data.hard_coded_addr.addr; |
| 5895 | return LLVMConstIntToPtr(LLVMConstInt(usize_type_ref, addr, false), type_entry->type_ref); |
| 5896 | } else { |
| 5897 | zig_unreachable(); |
| 5898 | } |
| 5892 | 5899 | case ZigTypeIdPointer: |
| 5893 | 5900 | return gen_const_val_ptr(g, const_val, name); |
| 5894 | 5901 | case ZigTypeIdErrorUnion: |