aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index b25a3b6869..43fc41bed9 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -1032,6 +1032,8 @@ static LLVMValueRef gen_cast_expr(CodeGen *g, AstNode *node) {
set_debug_source_node(g, node);
return LLVMBuildZExt(g->builder, expr_val, wanted_type->type_ref, "");
+ case CastOpIntToEnum:
+ return gen_widen_or_shorten(g, node, actual_type, wanted_type->data.enumeration.tag_type, expr_val);
}
zig_unreachable();
}
@@ -3913,7 +3915,7 @@ static void do_code_gen(CodeGen *g) {
LLVMZigAddNonNullAttr(fn_table_entry->fn_value, 1);
is_sret = true;
}
- if (fn_table_entry->is_pure && !is_sret) {
+ if (fn_table_entry->is_pure && !is_sret && g->is_release_build) {
LLVMAddFunctionAttr(fn_table_entry->fn_value, LLVMReadOnlyAttribute);
}