digitalmars.D.bugs - [Issue 12032] New: One case of refused slicing assignment to fixed size array
- d-bugmail puremagic.com (40/40) Jan 29 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12032
https://d.puremagic.com/issues/show_bug.cgi?id=12032 Summary: One case of refused slicing assignment to fixed size array Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc With dmd 2.065beta this compiles and runs with no errors: int[2] foo() { int[] a = [1, 2, 3, 4]; return a[0 .. 2]; // OK } void main() {} This compies and runs with no errors: void main() { int[] a = [1, 2, 3, 4]; int[2] b; b[] = a[$ - 2 .. $]; // OK } While this code: int[2] foo() { int[] a = [1, 2, 3, 4]; return a[$ - 2 .. $]; // Error } void main() {} Gives: test.d(3): Error: cannot implicitly convert expression (a[__dollar - 2u..__dollar]) of type int[] to int[2] I'd like this code to compile. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 29 2014