diff options
| author | jakubtomsu <66876057+jakubtomsu@users.noreply.github.com> | 2023-10-01 12:21:44 +0200 |
|---|---|---|
| committer | jakubtomsu <66876057+jakubtomsu@users.noreply.github.com> | 2023-10-01 12:21:44 +0200 |
| commit | c2684634132c0af6f2bd042280fcf667576fceb5 (patch) | |
| tree | 0e353a27e03d87ee0a28f00c2ef79b7785dc905c /src/check_type.cpp | |
| parent | 81fe93127d5b538dd44e80c7e38de6d8693f8557 (diff) | |
Allow zero-length enumerated arrays
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index a43c296a6..3360df040 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -2810,7 +2810,7 @@ gb_internal bool check_type_internal(CheckerContext *ctx, Ast *e, Type **type, T } } - if (!is_sparse && t->EnumeratedArray.count > bt->Enum.fields.count) { + if (!is_sparse && t->EnumeratedArray.count > bt->Enum.fields.count && bt->Enum.fields.count > 0) { error(e, "Non-contiguous enumeration used as an index in an enumerated array"); long long ea_count = cast(long long)t->EnumeratedArray.count; long long enum_count = cast(long long)bt->Enum.fields.count; |