class.c (finish_struct_1): Do not warn about non-virtual destructors in Java classes.
authorMark Mitchell <mark@codesourcery.com>
Mon, 7 Mar 2005 23:08:58 +0000 (23:08 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Mon, 7 Mar 2005 23:08:58 +0000 (23:08 +0000)
* class.c (finish_struct_1): Do not warn about non-virtual
destructors in Java classes.

* g++.dg/warn/Wnvdtor.C: New test.

From-SVN: r96054

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/Wnvdtor.C [new file with mode: 0644]

index 4c40681333faf4ca55edcc55bdb549e2c0311917..3048511f23b084797165b7dc1863b474c8c53b5a 100644 (file)
@@ -1,3 +1,8 @@
+2005-03-07  Mark Mitchell  <mark@codesourcery.com>
+
+       * class.c (finish_struct_1): Do not warn about non-virtual
+       destructors in Java classes.
+
 2005-03-05  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
 
        PR c++/19311
index ba89ea146ed47eb854a243f230f4e1298a3f4295..89346d6cf4aea8017a6d6af5755afa8608673a84 100644 (file)
@@ -5029,7 +5029,9 @@ finish_struct_1 (tree t)
   /* Build the VTT for T.  */
   build_vtt (t);
 
-  if (warn_nonvdtor && TYPE_POLYMORPHIC_P (t))
+  /* This warning does not make sense for Java classes, since they
+     cannot have destructors.  */
+  if (!TYPE_FOR_JAVA (t) && warn_nonvdtor && TYPE_POLYMORPHIC_P (t))
     {
       tree dtor;
 
index 3b330421f4bf47c47d79805c6044036fc8043d2d..452046fa557caa96584802e17606e90868d7ccfa 100644 (file)
@@ -1,3 +1,7 @@
+2005-03-07  Mark Mitchell  <mark@codesourcery.com>
+
+       * g++.dg/warn/Wnvdtor.C: New test.
+
 2005-03-07  Richard Sandiford  <rsandifo@redhat.com>
 
        * gcc.dg/torture/pr19683-1.c: New test.
diff --git a/gcc/testsuite/g++.dg/warn/Wnvdtor.C b/gcc/testsuite/g++.dg/warn/Wnvdtor.C
new file mode 100644 (file)
index 0000000..b04fdcb
--- /dev/null
@@ -0,0 +1,10 @@
+// { dg-options "-Wnon-virtual-dtor" }
+
+extern "Java"
+{
+  class Foo
+  {
+  public:
+    virtual void bar( void);
+  };
+}