[Issue 12698] Overloads from multiple modules implicitly merge into a single overloadset
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun May 4 04:02:15 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12698
--- Comment #2 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to Andrej Mitrovic from comment #0)
> I thought the following was supposed to emit a compiler error to prevent
> function hijacking:
>
> -----
> import std.algorithm; // defines copy
> import std.file; // defines another copy (unrelated)
>
> void main()
> {
> char[] src, target;
> copy(src, target);
> }
> -----
>
> No errors here, the copy from std.file is picked here.
Why do you think this is an issue? std.algorithm.copy does not match to
(char[], char[]) arguments, so std.file.copy is always chosen.
It follows the cross-module overload set resolution rule.
--
More information about the Digitalmars-d-bugs
mailing list