gcc/testsuite/gdc.test/runnable/test20893.d
raw| 1 | // REQUIRED_ARGS: -O -inline |
| 2 | // |
| 3 | // https://issues.dlang.org/show_bug.cgi?id=20893 |
| 4 | // caused by https://github.com/dlang/dmd/pull/9722 |
| 5 | |
| 6 | int f(int n) |
| 7 | { |
| 8 | foreach (i; 0..n) {} |
| 9 | return 10; |
| 10 | } |
| 11 | |
| 12 | int c(int a, int b) |
| 13 | { |
| 14 | return (f(a) * 1L * f(b)) % 1000; |
| 15 | } |
| 16 | |
| 17 | void main() |
| 18 | { |
| 19 | int[] a = [1]; |
| 20 | assert(c(2 - 1, 2) == 100); |
| 21 | } |