diff options
| author | gingerBill <bill@gingerbill.org> | 2019-10-06 14:55:25 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2019-10-06 14:55:25 +0100 |
| commit | 6c69e8c043e7dcf9d9965c7b28c7bdae44e0537c (patch) | |
| tree | af5f3434bcbc20a87e905a4f7646dc958b00ae8d /src/ir.cpp | |
| parent | 7fa2d25eea28955c12d8fc6a597e8615562c0ee9 (diff) | |
Make `typeid` semantics consistent across variables and constants
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 758267c24..f29d389f4 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -6592,6 +6592,11 @@ irValue *ir_build_expr_internal(irProcedure *proc, Ast *expr) { return ir_emit_conv(proc, x, tv.type); } + if (tv.value.kind == ExactValue_Typeid) { + irValue *v = ir_typeid(proc->module, tv.value.value_typeid); + return ir_emit_conv(proc, v, tv.type); + } + return ir_add_module_constant(proc->module, tv.type, tv.value); } |