Mail Archives: djgpp/1993/01/04/07:16:20
I've hit a problem with using the default constructors & assigment
operators generated by gcc. This is probably a gcc problem, but I
thought I'd check with experience here before going further.
I have three simple objects:
class Point
{
int x;
int y;
//...
};
class Vector
{
int dx;
int dy;
//...
};
class Area : public Point, public Vector
{
//...
};
Each of these does define constructors, both with and without arguments.
The copy constructor and default constructors don't exist.
The problem seems to occur in the following code fragment:
myfunc (const Area& a, const Point& o)
{
Area& x = a;
//...
The initialisation, which should involve calling the copy constructor,
doesn't occur. Only the default constructor is called.
Changing this to:
myfunc (const Area& a, const Point& o)
{
Area& x;
x = a;
//...
.. and it works, so the compiler generated assignment operator works.
Has anyone had similar experiences? If it is a gcc 2.2.2 bug, has it been
reported and fixed in 2.3.x?
- Raw text -