Can not overload template method function with const. Bug?
Tobias Pankrath
tobias at pankrath.net
Wed Aug 8 10:17:30 PDT 2012
On Wednesday, 8 August 2012 at 15:54:43 UTC, kenji hara wrote:
> 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
>
Thank you. Your patch works for me as well.
More information about the Digitalmars-d
mailing list