gcc/testsuite/gdc.test/fail_compilation/ice15441.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/ice15441.d(22): Error: `s1.front` is `void` and has no value |
| 5 | fail_compilation/ice15441.d(25): Error: cannot infer argument types, expected 1 argument, not 2 |
| 6 | --- |
| 7 | */ |
| 8 | |
| 9 | struct S1 |
| 10 | { |
| 11 | auto front()() {} |
| 12 | } |
| 13 | |
| 14 | struct S2 |
| 15 | { |
| 16 | auto front()() { return 1; } |
| 17 | } |
| 18 | |
| 19 | void main() |
| 20 | { |
| 21 | S1 s1; |
| 22 | foreach (p, e; s1) {} |
| 23 | |
| 24 | S2 s2; |
| 25 | foreach (p, e; s2) {} |
| 26 | } |