Java Classes and Non-virtual Destructors

Ranjit Mathew rmathew@gmail.com
Mon Mar 7 07:21:00 GMT 2005


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/


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /