]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gdc.test/fail_compilation/diag12432.d
Add D front-end, libphobos library, and D2 testsuite.
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / fail_compilation / diag12432.d
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/diag12432.d(55): Error: cannot infer argument types, expected 1 argument, not 2
5 fail_compilation/diag12432.d(56): Error: cannot infer argument types, expected 2 arguments, not 3
6 fail_compilation/diag12432.d(57): Error: cannot infer argument types, expected 1 argument, not 2
7 fail_compilation/diag12432.d(58): Error: cannot infer argument types, expected 1 argument, not 2
8 fail_compilation/diag12432.d(59): Error: cannot infer argument types, expected 2 arguments, not 3
9 fail_compilation/diag12432.d(60): Error: cannot infer argument types, expected 2 arguments, not 3
10 ---
11 */
12
13 struct R1
14 {
15 @property int front() { return 0; }
16 enum bool empty = false;
17 void popFront() { }
18 }
19
20 struct Tuple(T...)
21 {
22 T t;
23 alias t this;
24 }
25
26 struct R2
27 {
28 @property Tuple!(int, float) front() { return typeof(return).init; }
29 enum bool empty = false;
30 void popFront() { }
31 }
32
33 struct OpApply1Func
34 {
35 int opApply(int function(int)) { return 0; }
36 }
37
38 struct OpApply1Deleg
39 {
40 int opApply(int delegate(int)) { return 0; }
41 }
42
43 struct OpApply2Func
44 {
45 int opApply(int function(int, float)) { return 0; }
46 }
47
48 struct OpApply2Deleg
49 {
50 int opApply(int delegate(int, float)) { return 0; }
51 }
52
53 void main()
54 {
55 foreach (a, b; R1()) { }
56 foreach (a, b, c; R2()) { }
57 foreach (a, b; OpApply1Func()) { }
58 foreach (a, b; OpApply1Deleg()) { }
59 foreach (a, b, c; OpApply2Func()) { }
60 foreach (a, b, c; OpApply2Deleg()) { }
61 }