diff options
| author | Yong He <yonghe@outlook.com> | 2025-06-04 13:07:11 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-04 13:07:11 -0700 |
| commit | 2d7106640addf0ac88e0a5462117cd90b13a5e73 (patch) | |
| tree | 6ce27db4d6c5bf06db84dee755a82e09b1b3a2ca /source/slang/slang-check-expr.cpp | |
| parent | 812e478989e27983b8dea7ab11964de751654ba2 (diff) | |
Add legalization for 0-sized arrays. (#7327)
* Add legalization for 0-sized arrays.
* Allow 0-sized arrays in the front-end.
* More tests.
* Add `Conditional<T, hasValue>` type to core module.
* Update toc.
* Fix wording.
* Update test.
Diffstat (limited to 'source/slang/slang-check-expr.cpp')
| -rw-r--r-- | source/slang/slang-check-expr.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp index 1e052a553..66c2f9796 100644 --- a/source/slang/slang-check-expr.cpp +++ b/source/slang/slang-check-expr.cpp @@ -2414,10 +2414,10 @@ Expr* SemanticsExprVisitor::visitIndexExpr(IndexExpr* subscriptExpr) nullptr, ConstantFoldingKind::SpecializationConstant); - // Validate that array size is greater than zero + // Validate that array size is non-negative. if (auto constElementCount = as<ConstantIntVal>(elementCount)) { - if (constElementCount->getValue() <= 0) + if (constElementCount->getValue() < 0) { getSink()->diagnose( subscriptExpr->indexExprs[0], |
