This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Java Classes and Non-virtual Destructors
- From: Ranjit Mathew <rmathew at gmail dot com>
- To: mark at codesourcery dot com
- Cc: java at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Mon, 07 Mar 2005 12:48:06 +0530
- Subject: Java Classes and Non-virtual Destructors
Hi Mark,
After your patch for PR c++/19733, there have been tonnes
of warnings during a libjava build complaining about "class
Foo has virtual functions but non-virtual destructor".
Here's a simple testcase:
------------------------------ 8< ------------------------------
~/tmp > cat y.cpp
extern "Java"
{
class Foo
{
public:
virtual void bar( void);
};
}
~/tmp > mygxx -Wall -fsyntax-only y.cpp
y.cpp:4: warning: 'class Foo' has virtual functions but non-virtual destructor
------------------------------ 8< ------------------------------
If I do add a virtual destructor, I get:
------------------------------ 8< ------------------------------
~/tmp > mygxx -Wall -fsyntax-only y.cpp
y.cpp:7: error: Java class 'Foo' cannot have a destructor
------------------------------ 8< ------------------------------
which is correct, AFAICT.
Therefore, can you please suppress the warning for a "Java"
C++ class?
Thanks,
Ranjit.
--
Ranjit Mathew Email: rmathew AT gmail DOT com
Bangalore, INDIA. Web: http://ranjitmathew.hostingzero.com/