[Issue 9999] Integer literal 0 and 1 should prefer integer type in overload resolution

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 29 01:19:52 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9999



--- Comment #9 from Don <clugdbug at yahoo.com.au> 2013-04-29 01:19:47 PDT ---
I don't have strong feelings about this, but I don't know how to defend the
current behaviour.

Implicit conversion from int to bool is indeed rather odd. Do we really need
it? Initially, literal 0 and 1 sound like acceptable ways of writing 'false'
and 'true', but constant folding makes it much harder to justify.

foo( 8 - 7 );   // matches bool rather than long!

Long ago, D had a 'bit' type which was a 1-bit integer. It was replaced by
'bool'.  I think this is an odd case where D still has 'bit' semantics.
IE, bool _used to be_ an integer. It isn't any more. Perhaps we didn't go quite
far enough in replacing 'bit'.

-- 
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