destroy and @safe
Steven Schveighoffer
schveiguy at gmail.com
Tue Jun 21 18:41:57 UTC 2022
On 6/21/22 1:33 PM, H. S. Teoh wrote:
> On Tue, Jun 21, 2022 at 01:29:47PM -0400, Steven Schveighoffer via Digitalmars-d-learn wrote:
>> ```d
>> void foo(void delegate() @system dg) @safe {
>> int *bar;
>> @system void corrupt() { bar = cast(int *)0xdeadbeef;}
>> dg = &corrupt;
>> // can I call dg now?
>> }
>> ```
> [...]
>
> Does the language allow you to declare a @system delegate inside @safe
> code?
The code I wrote above compiles, even with dip1000. (note that I didn't
actually call the delegate)
-Steve
More information about the Digitalmars-d-learn
mailing list