[Issue 18520] New: Different delegates can be aliased to the same name multiple times
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Feb 25 03:51:57 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18520
Issue ID: 18520
Summary: Different delegates can be aliased to the same name
multiple times
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: monkeyworks12 at hotmail.com
The following code compiles with DMD 2.070.2 and prints 0 three times:
alias f = (int n) => 0;
alias f = (char c) => 'a';
alias f = (bool b) => false;
void main()
{
import std.stdio;
writeln(f(int.init)); //Prints 0
writeln(f(char.init)); //Prints 0
writeln(f(bool.init)); //Prints 0
}
It looks like the int overload is getting called each time.
--
More information about the Digitalmars-d-bugs
mailing list