digitalmars.D.bugs - [Issue 14017] New: Assignment of a mutable array returned from
- via Digitalmars-d-bugs (22/22) Jan 20 2015 https://issues.dlang.org/show_bug.cgi?id=14017
https://issues.dlang.org/show_bug.cgi?id=14017 Issue ID: 14017 Summary: Assignment of a mutable array returned from non-`pure` function to `immutable` global variable is allowed Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: accepts-invalid Severity: normal Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: verylonglogin.reg gmail.com This code compiles but shouldn't: --- auto f() { return new int[1]; } immutable s = f(); // error only with character arrays --- Also such code is currently rejected for arrays of characters. --
Jan 20 2015