http://d.puremagic.com/issues/show_bug.cgi?id=11244
Summary: Invalid warning about slice assignment Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: regression Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: c...@benjamin-thaut.de --- Comment #0 from Benjamin Thaut <c...@benjamin-thaut.de> 2013-10-13 09:11:32 PDT --- Created an attachment (id=1261) repro case Starting with dmd 2.063 it is no longer possible to create user defined types that behave exactly like build in types when it comes to slice assignment. Creating a user defined type with a propper slice operator which returns the slice of an array and then assignen that slice to an array will result in a warning: repro.d(20): Warning: explicit element-wise assignment copy[] = (s.opSlice())[] is better than copy[] = s.opSlice() The compiler does not seem to recognize the use of the slice operator here because tha analysis is done after rewriting the slice operator into the call to opSlice. This is especially anoying in generic code where a workaround like this has to be used to avoid the warning: static if(isArray!typeof(a)) copy[] = a[]; else copy[] = a[][]; See attached repro case. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------