Trouble with destroy

Jonathan M Davis jmdavisProg at gmx.com
Mon Sep 23 20:24:17 PDT 2013


On Tuesday, September 24, 2013 05:18:38 Meta wrote:
> On Monday, 23 September 2013 at 19:11:53 UTC, Namespace wrote:
> > As always. As soon as you wrote it, you've got the solution.
> > ----
> > destroy!A(a);
> > ----
> 
> This still seems like it should be worth reporting. I can't
> remember... Is partial ordering done between multiple matching
> template functions like it is with regular functions? If so,
> there should be no ambiguity in choosing the second one.

The problem is that the type matches two different templated functions, and as 
it stands, there is no way for the compiler to disambiguate. They're both 
equally valid. The only way that they could be disambiguated would be if the 
compiler preferred the actual type over the aliased one (which arguably, it 
should, but it clearly it doesn't at this point, and I don't know what all of 
the ramifications are if it did). But I don't think that there's anything wrong 
with destroy in this case. If there's a problem, it's with how alias this is 
handled when determining which overloaded template to use.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list