D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 8584 - bug with std.range.zip? range with opEquals(const) const not allowed inside zip
Summary: bug with std.range.zip? range with opEquals(const) const not allowed inside zip
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-25 13:40 UTC by thelastmammoth
Modified: 2014-03-18 07:27 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Comment 1 bearophile_hugs 2012-08-26 10:25:06 UTC
I suggest to explain the problem here again, with a minimal example code of the problem too.
Comment 2 thelastmammoth 2012-08-26 10:45:02 UTC
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 monarchdodra 2014-03-18 07:27:27 UTC
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.