little bug

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Fri Dec 31 20:54:00 GMT 1999


> Handle<AbstractClass>                       x(ConcreteClass());
> vector<Handle<AbstractClass> >       y(10,x);

This is not supposed to compile. This declares a (extern) function
'x', returning Handle<AbstractClass, expecting a function returning
ConcreteClass, expecting nothing (the parameter name was omit, the
full declaration would have been

  Handle<AbstractClass> x(ConcreteClass func());

So the vector constructor gets a function reference, and does not
expect it. The solution is simple:

  Handle<AbstractClass> x((0,ConcreteClass()));

In the comma expression, the first subexpression is ignored, and the
compiler won't emit code for it.

> vector<Handle<AbstractClass> >       x(10, Handle<AbstractClass>
> (ConcreteClass()));

I'm not surprised that this doesn't compile, either: There is no class
ConcreteClass, anywhere.

Regards,
Martin



More information about the Gcc-bugs mailing list