aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-06-19 15:18:51 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-06-19 15:18:51 -0400
commite36680d3bd08fceb3e976edeafae60ce6d577342 (patch)
tree60ca93229fabd17136dd6aa2389ba9d2c95ed6b7 /src/ir.cpp
parentb588a803bf4493d2fd1892fe172b9ce8cfb0ca30 (diff)
downloadzig-e36680d3bd08fceb3e976edeafae60ce6d577342.tar.gz
zig-e36680d3bd08fceb3e976edeafae60ce6d577342.zip
fix detection of unable to evaluate constant expression
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 3d125da1a1..6dfaa168ec 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -8647,7 +8647,7 @@ static ConstExprValue *ir_exec_const_result(CodeGen *codegen, IrExecutable *exec
return &codegen->invalid_instruction->value;
}
return &value->value;
- } else if (ir_has_side_effects(instruction)) {
+ } else if (ir_has_side_effects(instruction) && !instr_is_comptime(instruction)) {
exec_add_error_node(codegen, exec, instruction->source_node,
buf_sprintf("unable to evaluate constant expression"));
return &codegen->invalid_instruction->value;