Bug 13199 – const std.container.SList iteration

Status
NEW
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-07-24T11:27:55Z
Last change time
2024-12-01T16:22:04Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
bearophile_hugs
Moved to GitHub: phobos#10077 →

Comments

Comment #0 by bearophile_hugs — 2014-07-24T11:27:55Z
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
Comment #1 by robert.schadek — 2024-12-01T16:22:04Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10077 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB