July 16 [Issue 24665] New: Static array cast can be an unsafe lvalue | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24665 Issue ID: 24665 Summary: Static array cast can be an unsafe lvalue Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: nick@geany.org Both the cast assignments below corrupt the address of the Object reference in c[0]. They should be rejected in @safe code. void main() @safe { Object[1] c; (cast(size_t[1]) c) = 2; //! (cast(size_t[1]) c)[0] = 2; //! } Note that when used as an rvalue, the casts are OK. -- |
Copyright © 1999-2021 by the D Language Foundation