diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2025-05-02 15:38:43 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2025-05-02 15:38:43 +0200 |
| commit | 30c6fea9e9dfb9be1efff6ce4e6954ae138d06bf (patch) | |
| tree | 5a9d657e7b93c6ef986051d23e3f8383f42fa9e7 | |
| parent | 19fe75f020ac9570e708d3228ef17061a0a90222 (diff) | |
Allow polymorphic #simd array as return type
| -rw-r--r-- | src/check_type.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index 1549f477e..452da4023 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -3297,8 +3297,11 @@ gb_internal void check_array_type_internal(CheckerContext *ctx, Ast *e, Type **t if (generic_type != nullptr) { // Ignore } else if (count < 1 || !is_power_of_two(count)) { - error(at->count, "Invalid length for #simd, expected a power of two length, got '%lld'", cast(long long)count); *type = alloc_type_array(elem, count, generic_type); + if (ctx->disallow_polymorphic_return_types && count == 0) { + return; + } + error(at->count, "Invalid length for #simd, expected a power of two length, got '%lld'", cast(long long)count); return; } |