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 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
Is this a bug, or I misunderstand something?