Bug 19848 – colliding named imports in function silently fail to overload

Status
NEW
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2019-05-06T10:38:11Z
Last change time
2024-12-13T19:03:12Z
Assigned to
No Owner
Creator
FeepingCreature
Moved to GitHub: dmd#19560 →

Comments

Comment #0 by default_357-line — 2019-05-06T10:38:11Z
consider: module test; import std.stdio; void fooInt(int i) { writefln("int %s", i); } void fooFloat(float f) { writefln("float %s", f); } void main() { import test : foo = fooInt; import test : foo = fooFloat; foo(5.0f); } This will error with "fooInt(int i) is not callable using argument types float", even though a perfectly serviceable overload is available under the name.
Comment #1 by witold.baryluk+d — 2021-08-22T11:20:20Z
I just got hit by similar issue: void main() import core.time : Duration, TickDuration, to; import std.conv : to; Duration dur; dur.to!TickDuration(); } onlineapp.d(6): Error: template `core.time.to` cannot deduce function from argument types `!(TickDuration)(Duration)`, candidates are: /dlang/dmd/linux/bin64/../../src/druntime/import/core/time.d(1746): `to(string units, T, D)(D td)` Moving imports to be at module level is a workaround.
Comment #2 by robert.schadek — 2024-12-13T19:03:12Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19560 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB