[Issue 20941] __traits(getMember) should not allow safe code to access private fields

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 17 20:18:57 UTC 2020


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

Stanislav Blinov <stanislav.blinov at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stanislav.blinov at gmail.com

--- Comment #1 from Stanislav Blinov <stanislav.blinov at gmail.com> ---
For clarity, you mean modifying `tag` like so?

void unsafe() @safe
{
    S s;
    __traits(getMember, s, "tag") = 2; // should be error
    s.set(42);
}

--


More information about the Digitalmars-d-bugs mailing list