[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#356316: g++-4.0: -Wnon-virtual-dtor and -Wall produce false warnings



tags 356316 +patch
thanks

This turned out to be pretty trivial to fix, though it then took
something like 5 hours to rebuild gcc and test it!

--- gcc/cp/class.c~	2006-03-11 13:28:45.000000000 +0000
+++ gcc/cp/class.c	2006-03-11 13:30:19.000000000 +0000
@@ -5073,9 +5073,7 @@
 	     if it were virtual, we would have created it by now.  */
 	  !dtor
 	  || (!DECL_VINDEX (dtor)
-	      && (!TREE_PRIVATE (dtor)
-		  || CLASSTYPE_FRIEND_CLASSES (t)
-		  || DECL_FRIENDLIST (TYPE_MAIN_DECL (t)))))
+	      && !(TREE_PRIVATE (dtor) || TREE_PROTECTED (dtor))))
 	warning (0, "%q#T has virtual functions but non-virtual destructor",
 		 t);
     }
-- END --

This could probably do with a test case, and maybe rewording of the
warning to match the tighter test.

Ben.

-- 
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
                                                              - Albert Camus

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: