| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/test14496.d(21): Error: `void` initializing a pointer is not allowed in a `@safe` function |
| 5 |
fail_compilation/test14496.d(24): Error: `void` initializing a pointer is not allowed in a `@safe` function |
| 6 |
fail_compilation/test14496.d(28): Error: `void` initializing a pointer is not allowed in a `@safe` function |
| 7 |
fail_compilation/test14496.d(48): Error: `void` initializers for pointers is not allowed in a `@safe` function |
| 8 |
fail_compilation/test14496.d(49): Error: `void` initializers for pointers is not allowed in a `@safe` function |
| 9 |
fail_compilation/test14496.d(50): Error: `void` initializers for pointers is not allowed in a `@safe` function |
| 10 |
--- |
| 11 |
*/ |
| 12 |
// https://issues.dlang.org/show_bug.cgi?id=14496 |
| 13 |
@safe void foo() |
| 14 |
{ |
| 15 |
struct Foo { |
| 16 |
int* indirection1; |
| 17 |
Object indirection2; |
| 18 |
string[] indirection3; |
| 19 |
} |
| 20 |
|
| 21 |
Foo f = void; |
| 22 |
|
| 23 |
struct Bar { |
| 24 |
Foo foo = void; |
| 25 |
} |
| 26 |
|
| 27 |
struct Baz { |
| 28 |
int* x = void; |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
|
| 33 |
struct Foo { |
| 34 |
int* indirection1; |
| 35 |
Object indirection2; |
| 36 |
string[] indirection3; |
| 37 |
} |
| 38 |
|
| 39 |
struct Bar { |
| 40 |
Foo foo = void; |
| 41 |
} |
| 42 |
|
| 43 |
struct Baz { |
| 44 |
int* x = void; |
| 45 |
} |
| 46 |
|
| 47 |
@safe void sinister() { |
| 48 |
Bar bar; |
| 49 |
Baz baz; |
| 50 |
Bar[2] bars; // https://issues.dlang.org/show_bug.cgi?id=23412 |
| 51 |
} |