const(Rvalue) resolved to different overloads

Ali Çehreli via Digitalmars-d digitalmars-d at puremagic.com
Fri Dec 30 12:49:01 PST 2016


On 12/29/2016 11:59 PM, Jonathan M Davis via Digitalmars-d wrote:

 > In practice, I wouldn't expect it to matter - and usually if
 > you've overloaded on mutable and immutable, you're going to
 > want to overload on const as well anyway

Coming up with such guidelines is exactly the reason why I was 
experimenting with different combinations of overloads.

 > but the current behavior does make it entertaining to figure
 > out what's going to happen in corner cases

There are too many corner cases when one considers rvalue versus lvalue, 
const or immutable member indirections, const or immutable parameters, 
const or immutable expressions. :) Then there is 'auto ref' which 
competes with some of these cases.

Ali



More information about the Digitalmars-d mailing list