d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail12436.d
blob415e362bf2998d82a7824d43b471fa9b2e2384d8
1 alias void FuncType();
3 struct Opaque;
5 template Tuple(T...) { alias T Tuple; }
6 alias Tuple!(int, int) TupleType;
8 /******************************************/
9 // return type
12 TEST_OUTPUT:
13 ---
14 fail_compilation/fail12436.d(18): Error: functions cannot return a function
15 fail_compilation/fail12436.d(19): Error: functions cannot return a sequence (use `std.typecons.Tuple`)
16 ---
18 FuncType test1();
19 TupleType test2();
22 TEST_OUTPUT:
23 ---
24 fail_compilation/fail12436.d(28): Error: functions cannot return opaque type `Opaque` by value
25 fail_compilation/fail12436.d(29): Error: functions cannot return opaque type `Opaque[1]` by value
26 ---
28 Opaque ret12436a(); // error
29 Opaque[1] ret12436b(); // error
30 Opaque* ret12436c(); // no error
31 Opaque[] ret12436d(); // no error
32 Opaque[]* ret12436e(); // no error
34 ref Opaque ret12436f(); // no error
35 ref Opaque[1] ret12436g(); // no error
37 /******************************************/
38 // parameter type
41 TEST_OUTPUT:
42 ---
43 fail_compilation/fail12436.d(46): Error: cannot have parameter of function type `void()`
44 ---
46 void test3(FuncType) {}
49 TEST_OUTPUT:
50 ---
51 fail_compilation/fail12436.d(55): Error: cannot have parameter of opaque type `Opaque` by value
52 fail_compilation/fail12436.d(56): Error: cannot have parameter of opaque type `Opaque[1]` by value
53 ---
55 void param12436a(Opaque); // error
56 void param12436b(Opaque[1]); // error
57 void param12436c(Opaque*); // no error
58 void param12436d(Opaque[]); // no error
59 void param12436e(Opaque[]*); // no error
61 void param12436f(ref Opaque); // no error
62 void param12436g(ref Opaque[1]); // no error
63 void param12436h(out Opaque); // no error
64 void param12436i(out Opaque[1]); // no error
67 TEST_OUTPUT:
68 ---
69 fail_compilation/fail12436.d(75): Error: cannot have parameter of opaque type `A14906` by value
70 fail_compilation/fail12436.d(76): Error: cannot have parameter of opaque type `A14906[3]` by value
71 fail_compilation/fail12436.d(77): Error: cannot have parameter of opaque type `A14906[3][3]` by value
72 ---
74 enum A14906;
75 void f14906a(A14906) {}
76 void f14906b(A14906[3]) {}
77 void f14906c(A14906[3][3]) {}