aboutsummaryrefslogtreecommitdiff
path: root/src/types.c
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-05-02 21:16:09 +0100
committerGinger Bill <bill@gingerbill.org>2017-05-02 21:16:09 +0100
commitcc6282a6e3463dd2b0192789fbd373a6d8f59a3d (patch)
treebebc1e9f5cac3febb75d0ee2b6f8112660754171 /src/types.c
parent206a3e093c19245e0f8ec7872b7cc36a3d266b55 (diff)
Fix alignment and size bug of enums; Remove #ordered and make the default #ordered.
Diffstat (limited to 'src/types.c')
-rw-r--r--src/types.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/types.c b/src/types.c
index 5c60f19b7..711a74456 100644
--- a/src/types.c
+++ b/src/types.c
@@ -1595,6 +1595,8 @@ i64 type_align_of_internal(gbAllocator allocator, Type *t, TypePath *path) {
case Type_Record: {
switch (t->Record.kind) {
+ case TypeRecord_Enum:
+ return type_align_of_internal(allocator, t->Record.enum_base_type, path);
case TypeRecord_Struct:
if (t->Record.custom_align > 0) {
return gb_clamp(t->Record.custom_align, 1, build_context.max_align);
@@ -1844,6 +1846,9 @@ i64 type_size_of_internal(gbAllocator allocator, Type *t, TypePath *path) {
case Type_Record: {
switch (t->Record.kind) {
+ case TypeRecord_Enum:
+ return type_size_of_internal(allocator, t->Record.enum_base_type, path);
+
case TypeRecord_Struct: {
i64 count = t->Record.field_count;
if (count == 0) {