Bug 8297 – Cannot access front of array with immutable elements

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2012-06-25T09:04:00Z
Last change time
2012-06-25T17:53:27Z
Assigned to
nobody
Creator
rb

Comments

Comment #0 by rb — 2012-06-25T09:04:47Z
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
Comment #1 by issues.dlang — 2012-06-25T17:53:27Z
*** This issue has been marked as a duplicate of issue 6336 ***