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: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Kenji Hara <[email protected]> 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/[email protected]
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: -------