Issue with dmd 2.066, alias this, and sort

rcor via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 27 19:22:18 PDT 2014


On Wednesday, 27 August 2014 at 21:43:40 UTC, bearophile wrote:
>
> It compiles if you use:
> @property auto feature() const pure nothrow { return _feature; }
>
> Otherwise I get strange errors like:
>
> ...\dmd2\src\phobos\std\exception.d(986,31): Error: pure 
> function 'std.exception.doesPointTo!(Point, Point, 
> void).doesPointTo' cannot call impure function 
> 'temp.Point.feature'
>
> Bye,
> bearophile

Thanks bearophile, that does make the gist compile. However, in 
my own code, I'm getting all sorts of complaints from other 
modules about mutable methods not being callable on const objects 
(the alias this surfaces some methods that are mutable).
I guess its my own fault for not being diligent about 
const-correctness, but it seems odd that sort would care about 
the constness of feature() when it is sorting based on x and y. 
Do you know if there is a reason for this?


More information about the Digitalmars-d-learn mailing list