diff options
| author | gingerBill <bill@gingerbill.org> | 2019-11-05 19:37:19 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2019-11-05 19:37:19 +0000 |
| commit | a634444f99dca486673b8575a136dd99886ffb8a (patch) | |
| tree | 7f52260c3d5c71460d70864a3a411e2944005b7f /src/check_expr.cpp | |
| parent | 40546fbde27601c147f5c64d9c1138a5a40bb3b8 (diff) | |
Fix "Polymorphic parameter declared in return type doesn't compile #464" by giving a conversion error (code wasn't handling polymorphic result types as intended)
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 1d59f0530..995582f64 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -5731,9 +5731,13 @@ Entity **populate_proc_parameter_list(CheckerContext *c, Type *proc_type, isize } } else { // NOTE(bill): Create 'lhs' list in order to ignore parameters which are polymorphic - lhs_count = pt->params->Tuple.variables.count; + if (pt->params == nullptr) { + lhs_count = 0; + } else { + lhs_count = pt->params->Tuple.variables.count; + } lhs = gb_alloc_array(heap_allocator(), Entity *, lhs_count); - for_array(i, pt->params->Tuple.variables) { + for (isize i = 0; i < lhs_count; i++) { Entity *e = pt->params->Tuple.variables[i]; if (!is_type_polymorphic(e->type)) { lhs[i] = e; |