[Issue 19399] New: Different Conversion Rules for Same Value and Type -- Enum
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Nov 14 00:22:34 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19399
Issue ID: 19399
Summary: Different Conversion Rules for Same Value and Type --
Enum
Product: D
Version: D2
Hardware: Other
OS: All
Status: NEW
Severity: critical
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: sprink.noreply at gmail.com
void foo(byte v) { writeln("byte ", v); }
void foo(int v) { writeln("int ", v); }
enum A : int {
a = 127,
b = 128, // shh just ignore this
}
void main()
{
A v = A.a;
foo(A.a); // byte 127
foo(v); // int 127 should be byte 127
}
Per https://issues.dlang.org/show_bug.cgi?id=10560 the desired type to call is
"byte". So the bug should be fixed so that both the function call the
foo(byte) overload.
--
More information about the Digitalmars-d-bugs
mailing list