aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-01-16 11:41:58 +0000
committergingerBill <bill@gingerbill.org>2023-01-16 11:41:58 +0000
commit68b2d4b9e243d40a8e488f5f623532a46a53fb3a (patch)
tree1e7f5002265c406ba872f427a8f29d60f344abe3 /src
parent54f02f59dbe90f701266dee703d07e7a80ca0ac8 (diff)
Fix #2305
Diffstat (limited to 'src')
-rw-r--r--src/llvm_backend_expr.cpp3
-rw-r--r--src/llvm_backend_proc.cpp9
2 files changed, 11 insertions, 1 deletions
diff --git a/src/llvm_backend_expr.cpp b/src/llvm_backend_expr.cpp
index c28e9fb2b..1fa4b4809 100644
--- a/src/llvm_backend_expr.cpp
+++ b/src/llvm_backend_expr.cpp
@@ -3097,6 +3097,9 @@ gb_internal lbValue lb_build_expr_internal(lbProcedure *p, Ast *expr) {
// NOTE(bill): Short on constant values
return lb_const_value(p->module, type, tv.value);
+ } else if (tv.mode == Addressing_Type) {
+ // NOTE(bill, 2023-01-16): is this correct? I hope so at least
+ return lb_typeid(m, tv.type);
}
switch (expr->kind) {
diff --git a/src/llvm_backend_proc.cpp b/src/llvm_backend_proc.cpp
index f156d1ca0..b95fc7da6 100644
--- a/src/llvm_backend_proc.cpp
+++ b/src/llvm_backend_proc.cpp
@@ -3125,6 +3125,8 @@ gb_internal lbValue lb_build_call_expr_internal(lbProcedure *p, Ast *expr) {
GB_ASSERT(e->kind == Entity_Variable);
if (args[i].value == nullptr) {
args[i] = lb_handle_param_value(p, e->type, e->Variable.param_value, ast_token(expr).pos);
+ } else if (is_type_typeid(e->type) && !is_type_typeid(args[i].type)) {
+ args[i] = lb_typeid(p->module, args[i].type);
} else {
args[i] = lb_emit_conv(p, args[i], e->type);
}
@@ -3274,7 +3276,12 @@ gb_internal lbValue lb_build_call_expr_internal(lbProcedure *p, Ast *expr) {
continue;
}
GB_ASSERT_MSG(args[i].value != nullptr, "%.*s", LIT(e->token.string));
- args[i] = lb_emit_conv(p, args[i], e->type);
+ if (is_type_typeid(e->type) && !is_type_typeid(args[i].type)) {
+ GB_ASSERT(LLVMIsNull(args[i].value));
+ args[i] = lb_typeid(p->module, args[i].type);
+ } else {
+ args[i] = lb_emit_conv(p, args[i], e->type);
+ }
}
}
}