Showing a user specified error message when no overloads match

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 29 08:45:23 PDT 2014


On Tue, Jul 29, 2014 at 03:34:22AM +0000, Vlad Levenfeld via Digitalmars-d-learn wrote:
> opDispatch behaves as though it has SFINAE. When something fails in
> the definition (like I am having now, some of the symbols I used in it
> hadn't been imported) there won't ever be an error message, I just get
> "Error: no property 'bar' for type 'Foo'"
> 
> In one case I had to use static ifs and pragmas and static assert(0)
> to get error messages out of opDispatch because static assert messages
> were being suppressed.
> 
> Its very frustrating.

You're right, opDispatch behaves like SFINAE. I've had trouble debugging
it before, because when it works, it works very well, but when you
accidentally make a typo, it just "disappears" -- you get an error that
the property is missing, but the actual error inside opDispatch has been
gagged and it's almost impossible to get at the actual error message.

Maybe we should file an enhancement bug to improve error reporting for
opDispatch.


T

-- 
Time flies like an arrow. Fruit flies like a banana.


More information about the Digitalmars-d-learn mailing list