| 1 |
/* TEST_OUTPUT: |
| 2 |
--- |
| 3 |
fail_compilation/test19646.d(12): Error: cast from `const(int)*` to `int*` can't initialize `@safe` variable `y` |
| 4 |
fail_compilation/test19646.d(12): Source type is incompatible with target type containing a pointer |
| 5 |
fail_compilation/test19646.d(18): Error: `@safe` variable `z` cannot be initialized by calling `@system` function `f` |
| 6 |
--- |
| 7 |
https://issues.dlang.org/show_bug.cgi?id=19646 |
| 8 |
*/ |
| 9 |
|
| 10 |
@safe: |
| 11 |
const x = 42; |
| 12 |
int* y = cast(int*)&x; |
| 13 |
|
| 14 |
@system: |
| 15 |
|
| 16 |
@system int* f() { return cast(int*) 0xDEADBEEF; }; |
| 17 |
|
| 18 |
@safe int* z = f(); |