[comp.lang.c++] Type conversion and overloading

newsuser@LTH.Se (Lund Institute of Technology news server) (07/22/88)

Take the following program:

	overload f;
	extern void f(float y);
	overload g;
	extern void g(double y);

	main ()
	{
	  f(1);     // error: bad argument list for overloaded f()
	  f(2.0);
	  g(1);
	  g(2.0);
	}

Section 8.9 of "The C++ Programming Language" clearly states that:

	Only the following conversions will be applied... int to double...

so the error message is obviously intentional.

My question is, why isn't the integer converted in this case?  In the
example above, there is no ambiguity.  Is this (rare?) case not worth
the increase in compiler complexity?  Would it slow down the compiler
too much?  Has it been fixed in the much awaited release 2.0?


				Dag M Bruck-- 
Department of Automatic Control		Internet:  dag@control.lth.se
Lund Institute of Technology		UUCP:   ...!enea!control.lth.se!dag
P. O. Box 118
S-221 00 Lund, SWEDEN			Phone:	+46 46-108779