aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/check_expr.c13
-rw-r--r--src/parser.c10
2 files changed, 13 insertions, 10 deletions
diff --git a/src/check_expr.c b/src/check_expr.c
index f205935c2..a7e85f819 100644
--- a/src/check_expr.c
+++ b/src/check_expr.c
@@ -555,7 +555,13 @@ void check_struct_type(Checker *c, Type *struct_type, AstNode *node) {
struct_type->Record.field_count = field_count;
struct_type->Record.names = make_names_field_for_record(c, c->context.scope);
- if (false && !st->is_packed && !st->is_ordered) {
+ type_set_offsets(c->allocator, struct_type);
+
+
+ if (!struct_type->failure && !st->is_packed && !st->is_ordered) {
+ struct_type->failure = false;
+ struct_type->Record.are_offsets_set = false;
+ struct_type->Record.offsets = NULL;
// NOTE(bill): Reorder fields for reduced size/performance
Entity **reordered_fields = gb_alloc_array(c->allocator, Entity *, field_count);
@@ -576,12 +582,9 @@ void check_struct_type(Checker *c, Type *struct_type, AstNode *node) {
struct_type->Record.fields = reordered_fields;
}
- {
- // i64 size = type_size_of(c->allocator, struct_type);
- }
-
type_set_offsets(c->allocator, struct_type);
+
if (st->align != NULL) {
if (st->is_packed) {
syntax_error_node(st->align, "`#align` cannot be applied with `#packed`");
diff --git a/src/parser.c b/src/parser.c
index fb8d5d91b..403fcdda2 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -2746,11 +2746,11 @@ AstNode *parse_type_or_ident(AstFile *f) {
syntax_error(tag, "Duplicate struct tag `#%.*s`", LIT(tag.string));
}
is_packed = true;
- // } else if (str_eq(tag.string, str_lit("ordered"))) {
- // if (is_ordered) {
- // syntax_error(tag, "Duplicate struct tag `#%.*s`", LIT(tag.string));
- // }
- // is_ordered = true;
+ } else if (str_eq(tag.string, str_lit("ordered"))) {
+ if (is_ordered) {
+ syntax_error(tag, "Duplicate struct tag `#%.*s`", LIT(tag.string));
+ }
+ is_ordered = true;
} else if (str_eq(tag.string, str_lit("align"))) {
if (align) {
syntax_error(tag, "Duplicate struct tag `#%.*s`", LIT(tag.string));