[Issue 1192] broken overridden-function parameter list matching

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 26 21:33:17 PDT 2007


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





------- Comment #5 from ddparnell at bigpond.com  2007-04-26 23:33 -------
As I said earlier, the problem is when one uses literals. The compiler is quite
inflexible when it comes to assigning type to literals.

Try this ...

  void processLong(long x){}
  void processLong(ulong x){}

  void main() { processLong(42); }

Now it complains because '42' could be either a long or ulong and it doesn't
know which one you meant. So code one of these below instead ...

  void main() { processLong(42U); }
OR
  void main() { processLong(42L); }

now it stops complaining.

Seriously, if you saw '42' in someone's code how would you decide which of the
functions to call?


-- 



More information about the Digitalmars-d-bugs mailing list