2012/8/9 Tobias Pankrath <tob...@pankrath.net>: > On Wednesday, 8 August 2012 at 15:01:23 UTC, kenji hara wrote: >> >> In the declaration of std.typecons.Tuple: >> >> bool opEquals(R)(R rhs) if (isTuple!R) >> { >> // [snip] >> } >> >> bool opEquals(R)(R rhs) const if (isTuple!R) >> { >> // same as non-const version >> } >> >> Adding const version works correctly. >> What's the problem? >> >> Kenji Hara >> > That's exactly what I've tried first. Using a git clone from yesterday and > within phobos directory, using > >> make -f posix.mak > > > everything works. Now I'm adding the const version of opEquals and I get: > http://pastebin.com/akRdFfAJ > > But it's similar with the reduced example from the thread in d.learn. Does > that work for you?
I've tried following code now, and it is exactly the bug 8522. struct Point { bool opEquals(R)(R rhs) { return true; } bool opEquals(R)(R rhs) const { return true; } } void main() { Point mp; const Point cp; assert(mp == mp); assert(mp == cp); assert(cp == mp); assert(cp == cp); } This code doesn't work with current git head of dmd, but works with my patch. https://github.com/D-Programming-Language/dmd/pull/1075 Kenji Hara