Commit bd68c7b
committed
Fix pointer handling for array literals in ternary
The parser now checks whether the opposite branch is pointer-like
before scalarizing an array literal in `src/parser.c` (lines 3579–3590).
This keeps `(int[]){...}` branches pointer-valued when the ternary
participates in pointer contexts (e.g., selecting between `int *`
options), while still collapsing to a scalar in pure-scalar cases.
Previously the literal branch was always forced to a scalar, causing
`selected` to become `1` and leading to a segfault when dereferenced.1 parent 1495cf8 commit bd68c7b
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3625 | 3625 | | |
3626 | 3626 | | |
3627 | 3627 | | |
| 3628 | + | |
| 3629 | + | |
3628 | 3630 | | |
3629 | | - | |
| 3631 | + | |
3630 | 3632 | | |
3631 | 3633 | | |
3632 | 3634 | | |
3633 | | - | |
| 3635 | + | |
3634 | 3636 | | |
3635 | 3637 | | |
3636 | 3638 | | |
| |||
0 commit comments