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

David Eckardt <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]
                   |                            |om

--- Comment #2 from David Eckardt <[email protected]> ---
This looks like a bug to me:

int f(ubyte x) { return x.sizeof; }
int f(ushort x)  { return x.sizeof; }

enum E: ushort {a = 10}

static assert(E.a.sizeof == E.sizeof); // succeeds
static assert(E.a.sizeof == f(E.a));  // fails, f(ubyte) is called

E.a.sizeof can be 1 or 2 depending on how it is used. This is obviously an
error. My guess is that for a function call “E.a” is treated as if it was the
numeric literal “10”, then typeof(10) is used to pick the function from the
overloads.

--

Reply via email to