[gnu.g++.bug] possible g++ bug

duvarney@xyzzy.UUCP (Dan DuVarney) (11/01/88)

I am using g++ version 1.25 on a Sun 3/50 running SunOS 3.5.
It appears that g++ is incorrectly choosing which constructor
to use in certain cases. For example:

--------------------------------------------------
#include "stream.h"

class F {
  int i;
  float f;
public:
  F(int i1, float f1);
  F(int i1, int i2);
}

F::F(int i1, float f1)
 { i = i1; f = f1; cout << "int, float constructor called\n"; }

F::F(int i1, int i2)
 { i = i1 + i2; f = 0.0; cout << "int, int constructor called\n"; }

main()
{
  F f(0,0.0);
}
----------------------------------------------------

When I run this program the output is "int, int constructor called."
It seems to me that the int, float constructor should be called
instead -- although I am a C++ novice and could be wrong.


-- 
Dan DuVarney      ...!mcnc!rti!dg-rtp!duvarney