www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19394] New: Inconsistent overload resolution with named and

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 puremagic.com
          Reporter: dhasenan 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.

--
Nov 12 2018