Can we just have struct inheritence already?

Tim tim.dlang at t-online.de
Sat Jun 15 09:15:33 UTC 2019


On Thursday, 13 June 2019 at 21:26:37 UTC, Tim wrote:
> On Thursday, 13 June 2019 at 20:55:34 UTC, Exil wrote:
>> This problem happens because you are used @trusted. If you 
>> used @safe you wouldn't be able to increment pointers and 
>> modify the values the way you did in @trusted.
>
> Here is a completly @safe version:
>
> import std.stdio;
>
> static int[2] data;
> static int[253] data2;
>
> void test(bool b) @safe
> {
> 	data[b]++;
> }
>
> void main() @safe
> {
> 	bool b = void;
> 	writeln(data, data2);
> 	test(b);
> 	writeln(data, data2);	
> }
>
> If b is valid only data can change. But for me data2 changes, 
> even though it is never written to.

I have created a bugzilla issue for this bug: 
https://issues.dlang.org/show_bug.cgi?id=19968


More information about the Digitalmars-d mailing list