Skip to content

Commit

Permalink
Fix issue with distinct void as a member #1147
Browse files Browse the repository at this point in the history
  • Loading branch information
lerno committed Apr 9, 2024
1 parent 2065570 commit 3fcdd7f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/compiler/compiler_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -2848,6 +2848,10 @@ static inline StorageType type_storage_type(Type *type)
case TYPE_TYPEDEF:
type = type->canonical;
goto RETRY;
case TYPE_DISTINCT:
is_distinct = true;
type = type->decl->distinct->type;
goto RETRY;
default:
return STORAGE_NORMAL;
}
Expand Down
7 changes: 7 additions & 0 deletions test/test_suite/struct/struct_bad_member.c3
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ def Void = void;
struct Foo2 {
Void bar; // #error: Members cannot be of
}

distinct Void2 = void;
struct Foo3 {
Void2 bar; // #error: has unknown size
}

fn void main(String[] args) {
Foo foo;
Foo2 foo2;
Foo3 foo3;
}

0 comments on commit 3fcdd7f

Please sign in to comment.