[Issue 19569] overload resolution not right?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 10 08:19:06 UTC 2019


Simen Kjaeraas <simen.kjaras at gmail.com> changed:

           What    |Removed                     |Added
                 CC|                            |simen.kjaras at gmail.com

--- Comment #5 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
Still wrong. Consider:

void foo()() { throw new Exception(""); } // Definitely not nothrow
void foo()() nothrow { } // definitely is nothrow

void test()
void test() nothrow

This gives the exact same error as before, demonstrating that this is indeed a
problem exactly the way Manu describes it. However, if both variants of foo are
indeed inferred to be nothrow, the criticisms presented by Jacob are correct.

As for 'if the user explicitly added an attribute to a template, then inference
for that attribute should be disabled at the time of instantiation.', consider

void bar()() nothrow { throw new Exception(""); }
unittest { bar(); }

That gives the error message 'nothrow function bar!().bar may throw', so that
already is disabled - if a templated function is marked nothrow, it has to
abide by that promise.


More information about the Digitalmars-d-bugs mailing list