diff --git a/src/compiler/compiler_internal.h b/src/compiler/compiler_internal.h index d6849afa6..42f9f5dd7 100644 --- a/src/compiler/compiler_internal.h +++ b/src/compiler/compiler_internal.h @@ -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; } diff --git a/test/test_suite/struct/struct_bad_member.c3 b/test/test_suite/struct/struct_bad_member.c3 index fffaf25d7..49486d7ed 100644 --- a/test/test_suite/struct/struct_bad_member.c3 +++ b/test/test_suite/struct/struct_bad_member.c3 @@ -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; }