[Issue 20226] New: selective import in function scope fails to merge overload sets
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Sep 18 12:37:09 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20226
Issue ID: 20226
Summary: selective import in function scope fails to merge
overload sets
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: simen.kjaras at gmail.com
unittest {
import std.complex : abs;
import std.math : abs;
// template std.complex.abs cannot deduce function
// from argument types !()(int)
auto a = abs(1);
}
Changing the order of imports above makes the code compile.
Using regular imports correctly merges overload sets:
unittest {
import std.complex;
import std.math;
auto a = abs(1);
}
This is likely related to the restrictions on overload sets in function scopes:
unittest {
void fun() {}
void fun(int i) {} // declaration fun is already defined
}
--
More information about the Digitalmars-d-bugs
mailing list