diff options
| author | gingerBill <bill@gingerbill.org> | 2017-10-15 10:14:17 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2017-10-15 10:14:17 +0100 |
| commit | 94762b56f6b07156097846c2c927f120288f065d (patch) | |
| tree | a079a891c05ee8d2dfd195acb2f22c2cc321262d /src/ir.cpp | |
| parent | b3b688fa502c18c7892c5dfb37a2fc43727d26fc (diff) | |
Fix issue #122
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 864375250..a7766985a 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -664,19 +664,20 @@ bool ir_type_has_default_values(Type *t) { return ir_type_has_default_values(t->Array.elem); case Type_Struct: - if (!t->Struct.is_raw_union) { - for_array(i, t->Struct.fields) { - Entity *f = t->Struct.fields_in_src_order[i]; - if (f->kind != Entity_Variable) continue; - if (f->Variable.default_is_nil) { - // NOTE(bill): This is technically zero - continue; - } else if (f->Variable.default_value.kind != ExactValue_Invalid) { - return true; - } else if (f->Variable.default_is_undef) { - return true; - } + if (t->Struct.is_raw_union) return false; + for_array(i, t->Struct.fields) { + Entity *f = t->Struct.fields_in_src_order[i]; + if (f->kind != Entity_Variable) continue; + if (f->Variable.default_is_nil) { + // NOTE(bill): This is technically zero + continue; + } else if (f->Variable.default_value.kind != ExactValue_Invalid) { + return true; + } else if (f->Variable.default_is_undef) { + return true; } + bool sub = ir_type_has_default_values(f->type); + if (sub) return true; } break; } |