← Back to index
|
Original Bugzilla link
Bug 6935 – struct with @disable this cannot make range
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-11-12T01:11:00Z
Last change time
2014-02-14T23:21:25Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0
by k.hara.pg — 2011-11-12T01:11:57Z
Following code should compile, but doesn't. import std.range; struct R { @disable this(); // requires explicit initializer @property bool empty() const{ return false; } @property int front(){ return 0; } void popFront(){} @property R save(){ return this; } int back(){ return 0; } void popBack(){} int opIndex(size_t n){ return 0; } @property size_t length() const { return 0; } } static assert(isInputRange!R); static assert(isForwardRange!R); static assert(isBidirectionalRange!R); static assert(isRandomAccessRange!R);
Comment #1
by k.hara.pg — 2011-11-12T01:28:41Z
https://github.com/D-Programming-Language/phobos/pull/324
Comment #2
by k.hara.pg — 2011-11-14T04:48:11Z
https://github.com/D-Programming-Language/phobos/commit/bd5141b027b5acddde0cf8596a2d223b47e1f8d3
Comment #3
by github-bugzilla — 2014-02-14T23:21:25Z
Commit pushed to master at
https://github.com/D-Programming-Language/phobos
https://github.com/D-Programming-Language/phobos/commit/6f43a92cd2ed4b16e2dbf8cc6550396f82180b99
Fix predicate template implementations in std.traits and std.range Use T.init property instead of void initializer, because it will work even if T is const or immutable type. I must change a part of unit test for the bug 6935, because we cannot support ranges which overrides init property.