[Issue 14251] synchronized (mtx) doesn't check attributes (pure, const)

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Aug 30 06:52:02 PDT 2016


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

--- Comment #14 from Lodovico Giaretta <lodovico at giaretart.net> ---
(In reply to Andrei Alexandrescu from comment #13)
> Can someone produce an example in which invariants promised by D's system
> are broken?

immutable provides a strong guarantee, that allows me to put my immutable data
in ROM. If I manage to have an immutable object allocated in ROM and someone
tries to synchronize on it, my program will (in the best case) crash with a
segmentation fault, as the synchronized statement tries to modify a mutex that
is located in ROM.

--


More information about the Digitalmars-d-bugs mailing list