digitalmars.D.bugs - [Issue 13534] New: std.variant can violate memory safety
- via Digitalmars-d-bugs (27/27) Sep 26 2014 https://issues.dlang.org/show_bug.cgi?id=13534
https://issues.dlang.org/show_bug.cgi?id=13534 Issue ID: 13534 Summary: std.variant can violate memory safety Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: Phobos Assignee: nobody puremagic.com Reporter: ttanjo gmail.com The following code can be compiled in dmd v2.067-devel-590d4a9 but it should not. ------ import std.variant; void main() safe { auto foo() system { return 3; } auto v = Variant(&foo); v(); // foo is called in safe code!? } ------ Currently whole part of std.variant is marked as trusted but it should not because the safety of the functions or methods in this module depends on the components which are stored in VariantN, Algebraic etc. --
Sep 26 2014