| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/fail10115.d(35): Error: cannot have `out` parameter of type `S` because the default construction is disabled |
| 5 |
fail_compilation/fail10115.d(35): Error: cannot have `out` parameter of type `E` because the default construction is disabled |
| 6 |
fail_compilation/fail10115.d(35): Error: cannot have `out` parameter of type `U` because the default construction is disabled |
| 7 |
fail_compilation/fail10115.d(40): Error: struct `fail10115.S` default construction is disabled |
| 8 |
fail_compilation/fail10115.d(41): Error: struct `fail10115.S` default construction is disabled |
| 9 |
fail_compilation/fail10115.d(42): Error: union `fail10115.U` default construction is disabled |
| 10 |
--- |
| 11 |
*/ |
| 12 |
|
| 13 |
struct S |
| 14 |
{ |
| 15 |
int a; |
| 16 |
@disable this(); |
| 17 |
//this(int) { a = 1; } |
| 18 |
//~this() { assert(a !is 0); } |
| 19 |
} |
| 20 |
|
| 21 |
enum E : S |
| 22 |
{ |
| 23 |
A = S.init |
| 24 |
} |
| 25 |
|
| 26 |
union U |
| 27 |
{ |
| 28 |
S s; |
| 29 |
//this(this) { assert (s.a !is 0); } |
| 30 |
//~this() { assert (s.a !is 0); } |
| 31 |
} |
| 32 |
|
| 33 |
void main() |
| 34 |
{ |
| 35 |
void foo(out S s, out E e, out U u) { } |
| 36 |
|
| 37 |
S[] a; |
| 38 |
E[] e; |
| 39 |
U[] u; |
| 40 |
a.length = 5; // compiles -> NG |
| 41 |
e.length = 5; // compiles -> NG |
| 42 |
u.length = 5; // compiles -> NG |
| 43 |
|
| 44 |
S[1] x = (S[1]).init; |
| 45 |
foo(a[0], // compiles -> NG |
| 46 |
e[0], // compiles -> NG |
| 47 |
u[0]); // compiles -> NG |
| 48 |
} |