diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2019-03-03 13:00:00 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-03 13:00:00 +0100 |
| commit | 8fb8b5ed7e9fc7d58483aacdfb01454346ba790b (patch) | |
| tree | 18fbfd4026bcbd4d34c9d802c15f8bc267670f29 /src/ir.cpp | |
| parent | 76a6757ee9e838326519ffb30a81dc60667d253d (diff) | |
| parent | 7bd86bb3ec8cffe2758dde99f40233e093f6c0ce (diff) | |
Merge pull request #346 from Kelimion/fix-issue-345
Fix #345: panic when using enum as map key
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index eba159472..e3fe83c3b 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -3215,6 +3215,8 @@ irValue *ir_gen_map_key(irProcedure *proc, irValue *key, Type *key_type) { key = ir_emit_conv(proc, key, 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)) { + 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)); |