gcc/testsuite/gdc.test/runnable/test17940.d
raw| 1 | // PERMUTE_ARGS: -O |
| 2 | |
| 3 | // https://issues.dlang.org/show_bug.cgi?id=17940 |
| 4 | |
| 5 | struct Array |
| 6 | { |
| 7 | long length; |
| 8 | long ptr; |
| 9 | } |
| 10 | |
| 11 | struct Struct |
| 12 | { |
| 13 | bool b = true; |
| 14 | } |
| 15 | |
| 16 | void fun1(int) |
| 17 | { |
| 18 | } |
| 19 | |
| 20 | void fun2(Array arr, int, int) |
| 21 | { |
| 22 | assert(!arr.length); |
| 23 | } |
| 24 | |
| 25 | void fn(Struct* str) |
| 26 | { |
| 27 | Array arr; |
| 28 | if (!str) |
| 29 | { |
| 30 | return; |
| 31 | } |
| 32 | if (str) |
| 33 | { |
| 34 | fun1(str.b); |
| 35 | } |
| 36 | if (str.b) |
| 37 | { |
| 38 | fun2(arr, str.b, 0); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | void main() |
| 43 | { |
| 44 | Struct s; |
| 45 | fn(&s); |
| 46 | } |