https://issues.dlang.org/show_bug.cgi?id=19183
anonymous4 <dfj1es...@sneakemail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Hardware|x86_64 |All OS|Linux |All --- Comment #10 from anonymous4 <dfj1es...@sneakemail.com> --- You can use a wrapper to mark data as unsafe: @safe: const(int)* gInts; void main() { auto s = MyStruct(10); gInts = s.ints; //error, can't call @system unwrap } struct MyStruct { import core.stdc.stdlib; Unsafe!(int*) ints; this(int size) @trusted { ints = cast(int*) malloc(size); } ~this() { () @trusted { free(ints); }(); } scope ptr(this This)() { return ints; } } struct Unsafe(T) { private T data; @system: @disable this(this); this(T val){ data=val; } void opAssign(T val){ data=val; } T unwrap(){ return data; } alias unwrap this; } --