File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed
regression/ansi-c/null_pointer_constant1 Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ int main (int argc , char * argv [])
2+ {
3+ // Literal 0 is a valid null-pointer constant, which makes this conditional
4+ // operator well-formed.
5+ char * maybe_str = argc > 1 ? "args" : 0 ;
6+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ main.c
3+
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ --
7+ ^warning: ignoring
8+ ^CONVERSION ERROR$
Original file line number Diff line number Diff line change @@ -1642,6 +1642,18 @@ void c_typecheck_baset::typecheck_expr_trinary(if_exprt &expr)
16421642 return ;
16431643 }
16441644
1645+ if (
1646+ auto string_constant = expr_try_dynamic_cast<string_constantt>(operands[1 ]))
1647+ {
1648+ implicit_typecast (operands[1 ], pointer_type (string_constant->char_type ()));
1649+ }
1650+
1651+ if (
1652+ auto string_constant = expr_try_dynamic_cast<string_constantt>(operands[2 ]))
1653+ {
1654+ implicit_typecast (operands[2 ], pointer_type (string_constant->char_type ()));
1655+ }
1656+
16451657 if (operands[1 ].type ().id ()==ID_pointer &&
16461658 operands[2 ].type ().id ()!=ID_pointer)
16471659 implicit_typecast (operands[2 ], operands[1 ].type ());
You can’t perform that action at this time.
0 commit comments