http://d.puremagic.com/issues/show_bug.cgi?id=6753
Summary: "Reinterpret" cast of array to a tail const one doesn't work inside @trusted Product: D Version: D2 Platform: Other OS/Version: All Status: NEW Severity: regression Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: dmitry.o...@gmail.com --- Comment #0 from Dmitry Olshansky <dmitry.o...@gmail.com> 2011-10-01 14:09:34 PDT --- This used to work on 2.055: struct Interval{ int a,b; } @safe struct S { int[] arr; @trusted @property auto byInterval() const { return cast(const(Interval)[])arr; } } Now on 2.056head (on commit fac2d5107a003320ce5389de04fcb6705e3795c9) it's rejected with: Error: cast from const(int[]) to const(Interval)[] not allowed in safe code Maybe byInterval somehow doesn't override it's safety level to "trusted". The following workaround works which makes me think it's a bug in upcoming 2.056. @safe struct S { int[] arr; @trusted @property auto byInterval() const { const(int)[] tmp = arr; return cast(const(Interval)[])tmp; } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------