[Issue 9999] New: Integer literal 0 and 1 should prefer integer type in overload resolution
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Apr 27 11:04:06 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9999
Summary: Integer literal 0 and 1 should prefer integer type in
overload resolution
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: k.hara.pg at gmail.com
--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2013-04-27 11:04:05 PDT ---
I think this is unexpected for most of D users, but AFAIK, current compiler
implementation (and Walter) intents this behavior. So I honestly mark this as
'enhancement'.
Forum discussion:
http://forum.dlang.org/thread/klc5r7$3c4$1@digitalmars.com
This program:
import std.stdio;
void foo(bool b) { writeln("bool"); }
void foo(long l) { writeln("long"); }
void main()
{
foo(0);
foo(1);
foo(2);
}
Prints:
bool
bool
long
Integer literal 0 and 1 prefer 'bool' version than 'long' version.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list