BUG with an array of class objects

Philippe Lavoie lavoie@zeus.genie.uottawa.ca
Mon Jun 8 17:09:00 GMT 1998


Hi guys,

I found this annoying bug in egcs 1.0.3. Can someone tell me if this
is present in the latest snapshot ? (I'm not on the list, please
e-mail me).

Anyway, the problem is best described with an example

#include <iostream.h>

struct point {
public:
  point() { cerr << "A" ; }
  point(float a) { cerr << "B" ; }
  point(float* a, int b) { cerr << "C" ; }
};

int main(){
  point* a ; 

  a = new point[4]() ; 
  a = new point[4](0) ; 
  a = new point[4]((float*)0,0) ; 
  return 0 ; 
}

Running this program yields

AAAABBBBBBBB

I'm hoping for/needing

AAAABBBBCCCC

Let me know if you are able to solve this problem.

Phil

PS Again, I'm not subscribing to this list, please send me an e-mail
to my address.



More information about the Gcc-bugs mailing list