Opened 2 years ago

Last modified 2 years ago

#141 new defect

conditional expression warning

Reported by: pabuhr Owned by:
Priority: minor Component: cfa-cc
Version: 1.0 Keywords:
Cc:

Description

int main() {
    char c[1] = { 3 };
    int r = 3 < 4 ? c[0] : 4;
}
cfa test1.cfa
CFA Version 1.0.0 (debug)
test1.cfa:3:1 warning: rvalue to reference conversion of rvalue: constant expression (4 4: signed int)

This warning seems wrong.

Change History (1)

comment:1 Changed 2 years ago by Rob Schluntz

Yeah, this definitely confirms my theory about #140; it's converting 4 to a reference here (so you'll get a temporary) rather than converting c[0] to int. You should be able to see that in the generated code for this one.

Note: See TracTickets for help on using tickets.