Bug in tuple comparison?

Magnus Lie Hetland magnus at hetland.org
Thu Mar 24 10:45:20 PDT 2011


On 2011-03-24 18:25:30 +0100, bearophile said:

> Magnus Lie Hetland:
> 
>> I guess this is getting old by now ... but I've come across yet another bug :->
> 
> The out(result) turns the result into a const,

Riiight! Yes, I've seen that it's const, and (naughtily) cast away the 
constness (without modifying anything) in some cases. It didn't occur 
to me that that was the problem here. :) (In my original program, I 
didn't notice that I had gotten one of the values from outside the 
out-block, while the other was from the result. I guess I was "primed" 
to think that that wasn't the problem ;)

So the issue, then, I take it, is that you *can* compare a non-const 
tuple to a const-tuple, but you *cannot* compare a const-tuple to a 
non-const tuple (as per casting rules)?

Makes sense. Would have been nice with a slightly more obvious error 
message, but I guess that's always a problem with templates in any form 
;)

Aanyway -- glad the bug was just in my code/brain :D Thanks for the help,

- M

-- 
Magnus Lie Hetland
http://hetland.org



More information about the Digitalmars-d-learn mailing list