* [C++ Patch] PR 62232
@ 2014-09-17 15:37 Paolo Carlini
2014-09-18 12:43 ` Jason Merrill
2014-09-19 6:03 ` Gerald Pfeifer
0 siblings, 2 replies; 4+ messages in thread
From: Paolo Carlini @ 2014-09-17 15:37 UTC (permalink / raw)
To: gcc-patches; +Cc: Jason Merrill
[-- Attachment #1: Type: text/plain, Size: 211 bytes --]
Hi,
clang recently, in 3.5.0 if I remember correctly, stopped
-Wnon-virtual-dtor warning for final classes. I think it makes sense to
do the same.
Tested x86_64-linux.
Thanks,
Paolo.
////////////////////7
[-- Attachment #2: CL_62232 --]
[-- Type: text/plain, Size: 270 bytes --]
/cp
2014-09-17 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/62232
* class.c (finish_struct_1): Do not -Wnon-virtual-dtor warn
for final class types.
/testsuite
2014-09-17 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/62232
* g++.dg/cpp0x/Wdtor1.C: New.
[-- Attachment #3: patch_62232 --]
[-- Type: text/plain, Size: 1056 bytes --]
Index: cp/class.c
===================================================================
--- cp/class.c (revision 215325)
+++ cp/class.c (working copy)
@@ -6506,7 +6506,8 @@ finish_struct_1 (tree 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) && accessible_nvdtor_p (t))
+ && TYPE_POLYMORPHIC_P (t) && accessible_nvdtor_p (t)
+ && !CLASSTYPE_FINAL (t))
warning (OPT_Wnon_virtual_dtor,
"%q#T has virtual functions and accessible"
" non-virtual destructor", t);
Index: testsuite/g++.dg/cpp0x/Wdtor1.C
===================================================================
--- testsuite/g++.dg/cpp0x/Wdtor1.C (revision 0)
+++ testsuite/g++.dg/cpp0x/Wdtor1.C (working copy)
@@ -0,0 +1,13 @@
+// PR c++/62232
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wnon-virtual-dtor" }
+
+class base
+{
+protected:
+ ~base () {}
+ virtual void foo (){};
+};
+class derive final : public base
+{
+};
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [C++ Patch] PR 62232
2014-09-17 15:37 [C++ Patch] PR 62232 Paolo Carlini
@ 2014-09-18 12:43 ` Jason Merrill
2014-09-19 6:03 ` Gerald Pfeifer
1 sibling, 0 replies; 4+ messages in thread
From: Jason Merrill @ 2014-09-18 12:43 UTC (permalink / raw)
To: Paolo Carlini, gcc-patches
OK.
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [C++ Patch] PR 62232
2014-09-17 15:37 [C++ Patch] PR 62232 Paolo Carlini
2014-09-18 12:43 ` Jason Merrill
@ 2014-09-19 6:03 ` Gerald Pfeifer
2014-09-19 8:29 ` Paolo Carlini
1 sibling, 1 reply; 4+ messages in thread
From: Gerald Pfeifer @ 2014-09-19 6:03 UTC (permalink / raw)
To: Paolo Carlini; +Cc: gcc-patches, Jason Merrill
Hi Paolo,
On Wed, 17 Sep 2014, Paolo Carlini wrote:
> clang recently, in 3.5.0 if I remember correctly, stopped -Wnon-virtual-dtor
> warning for final classes. I think it makes sense to do the same.
mind adding a note to wwwdocs/htdocs/gcc-5/changes.html ?
Thanks,
Gerald
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [C++ Patch] PR 62232
2014-09-19 6:03 ` Gerald Pfeifer
@ 2014-09-19 8:29 ` Paolo Carlini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Carlini @ 2014-09-19 8:29 UTC (permalink / raw)
To: Gerald Pfeifer; +Cc: gcc-patches, Jason Merrill
Hi,
On 09/19/2014 08:03 AM, Gerald Pfeifer wrote:
> Hi Paolo,
>
> On Wed, 17 Sep 2014, Paolo Carlini wrote:
>> clang recently, in 3.5.0 if I remember correctly, stopped -Wnon-virtual-dtor
>> warning for final classes. I think it makes sense to do the same.
> mind adding a note to wwwdocs/htdocs/gcc-5/changes.html ?
Sure, I will!
Paolo.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-09-19 8:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-17 15:37 [C++ Patch] PR 62232 Paolo Carlini
2014-09-18 12:43 ` Jason Merrill
2014-09-19 6:03 ` Gerald Pfeifer
2014-09-19 8:29 ` Paolo Carlini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).