constexpr int object = _Generic (1, int: 1, default: 1.0);
sdcc -mz80 --std=c23 -S bug.c -o bug.asm
Also reproduced without preprocessing:
sdcc --c1mode -mz80 --std=c23 -o bug.asm < bug.c
SDCC 4.6.4 #17081 (Linux). A standalone candidate bug fix for [bugs:#4178] reproduces the same failure.
The compiler exits with status 1, first reporting an assignment type mismatch
from void to const int, followed by:
Internal error: validateLink failed in SPEC_SCLS(cexpr->etype) @ SDCCast.c:2206: expected SPECIFIER, got null-link
The selected association is the integer constant 1, so the valid C23 program should be accepted with object value 1. The unselected floating expression does not determine its type.
The native frontend failure was reproduced in C23 and C2Y modes on Z80, MCS51, STM8, PDK14 and MOS65C02. The paired sample with int: 1.0, default: 1 also reaches an internal error; the candidate bug fix for [bugs:#4178] adds the expected integer-initialiser diagnostic before that existing failure.
Diff:
Related
Bugs: #4178