opEquals(const ref yadaYada)

Steven Schveighoffer schveiguy at yahoo.com
Sun Dec 13 04:29:28 PST 2009


Richard Webb Wrote:

> Hi,
> I mentioned this problem in the thread @ 
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=18405
> 
> I ran into the rvalue problem while trying to get Juno to compile, and found that it builds ok if you declare both
> 
> bool opEquals(const ref Foo rhs) const
> 
> and
> 
> bool opEquals(Foo rhs) const
> 

Note the resulting bug: http://d.puremagic.com/issues/show_bug.cgi?id=3607

I also don't believe Richard's workaround is a "solution".  The compiler should not force you to create a const ref version if the argument can be implicitly cast from const to mutable.

-Steve



More information about the Digitalmars-d mailing list