mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
25 lines
668 B
D
25 lines
668 B
D
/*
|
|
REQUIRED_ARGS: -preview=dip1000 -de
|
|
TEST_OUTPUT:
|
|
---
|
|
fail_compilation/system_ptr_cast.d(20): Deprecation: cast from `S*` to `int*` will become `@system` in a future release
|
|
fail_compilation/system_ptr_cast.d(20): Source element type has unsafe bit patterns and target element type is mutable
|
|
fail_compilation/system_ptr_cast.d(24): Deprecation: cast from `int*` to `S*` will become `@system` in a future release
|
|
fail_compilation/system_ptr_cast.d(24): Target element type has unsafe bit patterns
|
|
---
|
|
*/
|
|
|
|
struct S
|
|
{
|
|
@system int i;
|
|
}
|
|
|
|
void main() @safe
|
|
{
|
|
S s;
|
|
auto p = cast(int*) &s;
|
|
*p = 8;
|
|
|
|
int i = 8;
|
|
auto ps = cast(S*) &i;
|
|
}
|