Closed Vinillia closed 9 months ago
Seems like the semantics analyser assumed the given expression was an array, due to the identifier of the second node of TernaryExpr being iREFARRAY, so it ran ::CheckArrayReturnStmt() and it errors from there due to nullptr dereferencing later on.
I decided to make a fix for this because why not - will be making a pull request from my fork soon.
This is fixable with a very tiny change to CheckReturnArrayExpr, in that we can swap "sub" for "val" and it mostly just works. val
carries array information, except... for enum structs. which aren't covered in the test suite for this use case, but should be.
Adding a "semantic_type" field to value
would fix this, but maybe it's time to say goodbye to the "enum structs are desugared arrays" hack.
Thanks for the report, this single-handedly motivated a really important refactoring. I folded the fix into PR #945.
SourcePawn Engine: 1.12.0.7102, jit-x86 (build 1.12.0.7102)
Code to reproduce crash: