Bug 8584 – bug with std.range.zip? range with opEquals(const) const not allowed inside zip

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-08-25T13:40:00Z
Last change time
2014-03-18T07:27:27Z
Assigned to
nobody
Creator
thelastmammoth

Comments

Comment #0 by thelastmammoth — 2012-08-25T13:40:09Z
Comment #1 by bearophile_hugs — 2012-08-26T10:25:06Z
I suggest to explain the problem here again, with a minimal example code of the problem too.
Comment #2 by thelastmammoth — 2012-08-26T10:45:02Z
copied form the above mentioned thread: --- import std.range; struct A{ int x; //bool opEquals(const A a) {return a.x==x;} //comiles when this is used //bool opEquals(const A a)const{return a.x==x;} //will not compile bool opEquals(A a)const{return a.x==x;} //will not compile } struct Range(S){ auto front(){return 0;} auto popFront(){} auto empty(){return false;} } void main(){ auto a=Range!A(); zip(a,a); } ---- phobos/std/range.d(3449): Error: function std.typecons.Tuple!(Range!(A),Range!(A)).Tuple.opEquals!(const(Tuple!(Range!(A),Range!(A)))).opEquals (const(Tuple!(Range!(A),Range!(A))) rhs) is not callable using argument types (const(Tuple!(Range!(A),Range!(A)))) const phobos/std/range.d(3811): Error: template instance std.range.Zip!(Range!(A),Range!(A)) error instantiating scratchd(26): instantiated from here: zip!(Range!(A),Range!(A)) test_scratch.d(26): Error: template instance std.range.zip!(Range!(A),Range!(A)) error instantiating
Comment #3 by monarchdodra — 2014-03-18T07:27:27Z
Appears solved. Not sure what fixed it, but I made some improvements to tuple that allows construction with const elements. That was probably the fixer.