[Issue 8297] New: Cannot access front of array with immutable elements

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 25 09:02:19 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8297

           Summary: Cannot access front of array with immutable elements
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: rb at d-coding.com


--- Comment #0 from Roman D. Boiko <rb at d-coding.com> 2012-06-25 09:04:47 PDT ---
import std.range;
struct Element {
  //immutable // uncomment to break compilation
   int _i;
  this(int i) { _i = i; }
}
void main() {
  auto arr = [Element.init];
  arr.front;
}

Declaring _i as immutable yields the following compilation error:

/usr/include/x86_64-linux-gnu/dmd/phobos/std/array.d(460): Error: 
a[0LU] isn't mutable
sample.d(11): Error: template instance std.array.front!(Element) 
error instantiating

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list