[Issue 19394] New: Inconsistent overload resolution with named and non-named enums

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 12 21:00:34 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19394

          Issue ID: 19394
           Summary: Inconsistent overload resolution with named and
                    non-named enums
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dhasenan at gmail.com

---
import std.stdio;
void foo(bool b) { writefln("bool %s", b); }
void foo(int b) { writefln("int %s", b); }
enum : int { a = 0 }
enum A : int { a = 0 }

void main()
{
  foo(a);
  foo(A.a);
}
---

Hoped-for result:
int 0
int 0

Expected result after reading DIP1015 and its rejection:
bool false
bool false

Actual result:
int 0
bool false

To give name to a thing, it seems, is to change its very nature.

--


More information about the Digitalmars-d-bugs mailing list