History

Fix conversion in a?0:ptr.

(cond ? 0 : ptr)->member wasn't handled correctly. If one arm is a null pointer constant (which also can be a pointer) the result type is that of the other arm.

Michael Matz committed 14 years ago

Commit 6471ec01 parent f98c2302 files · +27 −5Browse files

Showing the changes to tests (1 of 2 files). Show all

Unified · Split

tests/tcctest.c+13−0
@@ -2486,3 +2486,16 @@ void const_warn_test(void) · 2485 unmodified lines
2486{2486{
2487 const_func(1);2487 const_func(1);
2488}2488}
2489
2490struct condstruct {
2491 int i;
2492};
2493
2494int getme (struct condstruct *s, int i)
2495{
2496 int i1 = (i == 0 ? 0 : s)->i;
2497 int i2 = (i == 0 ? s : 0)->i;
2498 int i3 = (i == 0 ? (void*)0 : s)->i;
2499 int i4 = (i == 0 ? s : (void*)0)->i;
2500 return i1 + i2 + i3 + i4;
2501}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t