[Issue 9999] 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 15:29:19 PDT 2013
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=9999
Martin Nowak <code at dawg.eu> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code at dawg.eu
--- Comment #5 from Martin Nowak <code at dawg.eu> 2013-04-27 15:29:18 PDT ---
I can't come up with a use-case for '1' to bool conversion.
We already deviate from C++ as there is no implicit integral to bool
conversion.
bool b = 0;                 // implicit, questionable
bool b = 1;                 // implicit, questionable
bool b = 3;                 // error
bool b = int_val;           // error
bool b = cast(bool)int_val; // explicit
int i = false;              // implicit
int i = true;               // implicit
int i = bool_val;           // implicit
int i = cast(int)bool_val;  // explicit
The if-condition is handled as explicit cast(bool)expr right?
if (0) {}                   // explicit
if (int_val) {}             // explicit
Now one thing that worries me is that we already had a similar discussion with
short/long overloads.
-- 
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