Bug 17631 – Can overload functions with simple enum argument, but not with complex enum argument

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-07-10T15:56:09Z
Last change time
2024-12-13T18:53:16Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Eric
Moved to GitHub: dmd#19279 →

Comments

Comment #0 by eric — 2017-07-10T15:56:09Z
import std.stdio; enum A : int { a, b }; enum B : int { a, b }; enum AS : string[2] { a = ["1","2"], b = ["3","4"] }; enum BS : string[2] { a = ["5","6"], b = ["7","8"] }; void func(A x) { writeln("A"); } void func(B x) { writeln("B"); } void funcs(AS x) { writeln("AS"); } void funcs(BS x) { writeln("BS"); } void test() { func(A.a); // no compiler error funcs(AS.a); // compiler error: matches both funcs(AS) and funcs(BS) } void main(string[] args) { } In the above code, the functions with the simple enum type argument can be overloaded, but the functions with the complex enum type argument cannot be overloaded.
Comment #1 by robert.schadek — 2024-12-13T18:53:16Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19279 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB