diff options
Diffstat (limited to 'src/types.cpp')
| -rw-r--r-- | src/types.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/types.cpp b/src/types.cpp index dd05f3238..dec7428eb 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -1864,21 +1864,20 @@ i64 type_align_of_internal(gbAllocator allocator, Type *t, TypePath *path) { return max; } else if (t->Struct.fields.count > 0) { i64 max = 1; - if (t->Struct.is_packed) { - max = build_context.word_size; - } + // NOTE(bill): Check the fields to check for cyclic definitions for_array(i, t->Struct.fields) { Type *field_type = t->Struct.fields[i]->type; type_path_push(path, field_type); - if (path->failure) { - return FAILURE_ALIGNMENT; - } + if (path->failure) return FAILURE_ALIGNMENT; i64 align = type_align_of_internal(allocator, field_type, path); type_path_pop(path); if (max < align) { max = align; } } + if (t->Struct.is_packed) { + return 1; + } return max; } } break; |