[Issue 13199] New: const std.container.SList iteration
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Jul 24 04:27:55 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13199
Issue ID: 13199
Summary: const std.container.SList iteration
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P1
Component: Phobos
Assignee: nobody at puremagic.com
Reporter: bearophile_hugs at eml.cc
It's not easy to iterate on a SList in a post-condition:
import std.container: SList;
auto foo()
out (result) {
foreach (x; result) {}
foreach (x; result[]) {}
} body {
SList!int sl;
return sl;
}
void main() {}
dmd 2.066beta4 gives:
test.d(4,5): Error: no property 'popFront' for type 'const(SList!int)'
test.d(4,5): Error: mutable method std.container.slist.SList!int.SList.front is
not callable using a const object
test.d(5,23): Error: mutable method std.container.slist.SList!int.SList.opSlice
is not callable using a const object
--
More information about the Digitalmars-d-bugs
mailing list