Commit feddce5
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 e57c5c6 commit feddce5
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3578 | 3578 | | |
3579 | 3579 | | |
3580 | 3580 | | |
| 3581 | + | |
| 3582 | + | |
3581 | 3583 | | |
3582 | | - | |
| 3584 | + | |
3583 | 3585 | | |
3584 | 3586 | | |
3585 | 3587 | | |
3586 | | - | |
| 3588 | + | |
3587 | 3589 | | |
3588 | 3590 | | |
3589 | 3591 | | |
| |||
0 commit comments