[Issue 17983] Integer literal should prefer int to char overload
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed Nov 15 00:09:31 UTC 2017
    
    
  
https://issues.dlang.org/show_bug.cgi?id=17983
Mike <slavo5150 at yahoo.com> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |slavo5150 at yahoo.com
--- Comment #1 from Mike <slavo5150 at yahoo.com> ---
This doesn't appear to be a cast/conversion or overload problem.  What's
happening is the the compiler is keeping the first alias in lexical order, and
ignoring any other aliases.  i.e. the following works
alias foo = (int i) => 4;   // Notice int overload is first
alias foo = (char c) => 1;
enum int e = 7;
static assert(foo(e) == 4);
The compiler should probably emit an error on the second alias as foo is being
redefined, but it certainly shouldn't just silently ignore it.
--
    
    
More information about the Digitalmars-d-bugs
mailing list