Anti-hijacking? I knew it, but it's not applicable here.
I mean these functions should not conflict because their argument
types do not intersect. You can't mistake Regex for String, these
checks are present in template constraints, is it not enough?

I think there is more to it. The algorithm to process overloading from
multiple overload sets is quite complex, and one of the problems of C++.

I can't remember the name of it, but D just avoids it by not allowing
multiple overload sets.

It is allowed from the same doc, as long as not ambiguous:

import A;
import B;

void bar(C c) {
 foo(); // calls A.foo()
 foo(1L); // calls A.foo(long)
 foo(c); // calls B.foo(C) foo(1,2); // error, does not match any foo
 foo(1); // error, matches A.foo(long) and B.foo(int)
 A.foo(1); // calls A.foo(long)
}

I'm implying that in case where one overload set contains no valid functions (constraints fail) the other should be used.


In any case, it's not a bug, it's by design.

Not so sure, maybe bug in phobos then.


--
Dmitry Olshansky

Reply via email to