July 09 [Issue 24656] New: enums with explicit EnumBaseType incorrectly matching multiple overloads. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24656 Issue ID: 24656 Summary: enums with explicit EnumBaseType incorrectly matching multiple overloads. Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: dave287091@gmail.com The following code fails to compile due to matching multiple overloads, which shouldn’t be correct. ``` import std; void foo(ubyte x){ writeln("foo(ubyte)"); } void foo(byte x){ writeln("foo(byte)"); } enum E: ubyte { A = 0, B = 1, Z = 255, } void main(){ ubyte a = 1; byte b = 2; foo(a); // ok foo(b); // ok foo(E.Z); // ok foo(E.A); // matches both foo(ubyte) and foo(byte) } ``` -- |
Copyright © 1999-2021 by the D Language Foundation