opEquals(const ref yadaYada)
lws
invalid at email.com
Mon Dec 14 01:30:33 PST 2009
On 2009-12-13 04:29:28 -0800, Steven Schveighoffer <schveiguy at yahoo.com> said:
> 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
I don't know if I buy that the opEquals thing is a bug. However,
that const destructor thing in the other thread needs to be fixed.
////////////////////////////////
struct Foo
{
~this()
{
}
}
void Bar()
{
const Foo f;
}
////////////////////////////////
Definitely produces incorrect behavior.
More information about the Digitalmars-d
mailing list