aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeroen van Rijn <jeroen@paramythic.com>2019-03-02 13:21:01 +0100
committerJeroen van Rijn <jeroen@paramythic.com>2019-03-02 13:21:01 +0100
commitb6d6eb6ae2d22935d146df8bc715c580fe5cb321 (patch)
treed162882d756d24e00175d31fec3b7e6bcbbe1f10 /src
parenta126d2ba16b54334e83ce3ec8fb7de99b67f5647 (diff)
Fix #345: Panic when using enum as map key
Also add a little map demo.
Diffstat (limited to 'src')
-rw-r--r--src/ir.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index d52b4beaf..e3fe83c3b 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -3216,8 +3216,7 @@ irValue *ir_gen_map_key(irProcedure *proc, irValue *key, Type *key_type) {
if (is_type_integer(t)) {
ir_emit_store(proc, ir_emit_struct_ep(proc, v, 0), ir_emit_conv(proc, key, hash_type));
} else if (is_type_enum(t)) {
- irValue *e = ir_emit_bitcast(proc, key, t_uint);
- ir_emit_store(proc, ir_emit_struct_ep(proc, v, 0), ir_emit_conv(proc, e, hash_type));
+ ir_emit_store(proc, ir_emit_struct_ep(proc, v, 0), ir_emit_conv(proc, key, hash_type));
} else if (is_type_typeid(t)) {
irValue *i = ir_emit_bitcast(proc, key, t_uint);
ir_emit_store(proc, ir_emit_struct_ep(proc, v, 0), ir_emit_conv(proc, i, hash_type));