[Issue 20722] typeid(X).initializer() breaks safety

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 7 20:38:16 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=20722

--- Comment #3 from Rainer Schuetze <r.sagitario at gmx.de> ---
As my example tried to demonstrate, you can do this with a null pointer to
struct (or class) aswell:

import std.stdio;
struct S { int a, b; }
void main() @safe
{
    S* s;
    int* p = &s.b;
    writeln(p); // 4
    *p = 3;     // segfault
}

--


More information about the Digitalmars-d-bugs mailing list