opDispatch compiles fine, but still fails to resolve?

Vlad Levenfeld via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 9 08:21:29 PDT 2014


On Saturday, 9 August 2014 at 05:42:09 UTC, H. S. Teoh via 
Digitalmars-d-learn wrote:
> Why would having opDispatch actually generate compile errors 
> cause
> problems for __traits(compiles,...)? __traits(compiles...) 
> already works
> fine with a whole bunch of other non-compiling stuff (by 
> gagging errors
> while it attempts them).
>
> The problem with opDispatch is that it gags too much, even when 
> the
> resolution ultimately fails, so you're left with mysterious
> "disappearances" of opDispatch with no hint as to what went 
> wrong. I'm
> not familiar with this part of DMD, but surely there's a way to 
> make
> this behave better??
>
>
> T

You're right, between you and Artur and a night's rest I'm 
realizing what an utter mess my post was. At that point I had 
lost half a day debugging this and hadn't slept much so my 
thought process was not particularly coherent.

The only thing I've ever really managed to get out of opDispatch 
in terms of errors is to litter the thing with pragma(msg, ...) 
and hope that, on visual inspection, something clicks and I can 
figure out where I went wrong.

I think the real crux of my issue was misunderstanding "auto 
ref". After I noticed that I could use "const" or "@property" or 
some other qualifier instead of auto, I assumed that it implied 
auto, so that ref @property => auto ref @property. Evidently not. 
I was looking inside the method body for the issue when it was on 
that first line the whole time.


More information about the Digitalmars-d-learn mailing list