Qt-interest Archive, March 2002
Missing warning from GCC could cause destructor problems
Message 1 in thread
Here's a problem which only showed up when I compiled my project under MSVC
(at least compiling under gcc 2.95 with -W -Wall doesn't generate an error
or warning):
// forward declaration of MyClass to speed up compilation
class MyClass;
class MyOtherClass : public QSomething
{
Q_OBJECT
...
QPtrList<MyClass> myList;
...
};
MSVC generates a warning that QPtrList<FindChannel> wants it to generate
code to delete the object, but because the declaration of MyClass is
incomplete it cannot, so no destructor will be called.
Easy to fix, just #include the full definition of MyClass, but would be a
swine to debug.
Or am I wrong about gcc? Maybe it can figure out how to destroy MyClass? I
doubt it.
Any one else come up against this? Is it fixed in gcc 3.0?
--
[ signature omitted ]