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

timotheecour thelastmammoth at gmail.com
Sat Aug 25 12:58:12 PDT 2012


is that a bug? should i file a bug report?

---
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



related question:
what is the "standard " signature for opEquals ?
is it:
         bool opEquals(const ref A a)const
         bool opEquals(A a)const
         bool opEquals(A a)
?




More information about the Digitalmars-d mailing list