From patchwork Fri Feb 15 17:19:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 220779 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 39E052C007B for ; Sat, 16 Feb 2013 04:19:45 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1361553586; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=ZoB+JsC W0KCfWggAMjwI5du0rgQ=; b=gxKAdRKXBHM3uYzZjLiJV6MVKyw8tIDfd6HyRxE KkdfVj3TO3xDiu2vD7oL4eGUw7JM0SYxQLUKs3hLWtPVXWYzEwJFZEj0NMCwrd9z lZZzVpLzciiTh0YTfUB25ZcpTPqHBf9pFe48aK9TzVboGGridshl3InglK1K+Ffn DDR0= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=iw9B2HPv6olvVJO+ixzvOrLSEJ7z8X0+R6vJkfO+KjoBUEOeK4hKW/N4J9YIgO kppWzPw4G79L+SSKDcZzdta7B3b/je5npyWM3Na79OtWKuguPY+aXxfTJgUvP/Lp 19WaeTLetaix5ffW1VhzuxmeLgSIF6wHdOfVGE4JbvqN4=; Received: (qmail 2392 invoked by alias); 15 Feb 2013 17:19:33 -0000 Received: (qmail 2373 invoked by uid 22791); 15 Feb 2013 17:19:29 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_SPAMHAUS_DROP, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 15 Feb 2013 17:19:18 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1FHJHdD021844 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 15 Feb 2013 12:19:17 -0500 Received: from [10.3.113.52] (ovpn-113-52.phx2.redhat.com [10.3.113.52]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1FHJGU6032751 for ; Fri, 15 Feb 2013 12:19:17 -0500 Message-ID: <511E6E14.3060407@redhat.com> Date: Fri, 15 Feb 2013 12:19:16 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:20.0) Gecko/20100101 Thunderbird/20.0a2 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/56343 (wrong EH spec error with defaulted destructor) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org We were adjusting the EH specification for destructors before looking at the base classes, so we hadn't yet noticed that there was a non-trivial base destructor to make things more complicated. Tested x86_64-pc-linux-gnu, applying to trunk. commit 799ff49ea8aa959deed277b590954bc3ef8253d2 Author: Jason Merrill Date: Fri Feb 15 10:30:22 2013 -0500 PR c++/56343 * class.c (check_bases_and_members): Deduce noexcept after checking bases. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 38339f2..eaa109a 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5245,14 +5245,15 @@ check_bases_and_members (tree t) cant_have_const_ctor = 0; no_const_asn_ref = 0; - /* Deduce noexcept on destructors. */ - if (cxx_dialect >= cxx0x) - deduce_noexcept_on_destructors (t); - /* Check all the base-classes. */ check_bases (t, &cant_have_const_ctor, &no_const_asn_ref); + /* Deduce noexcept on destructors. This needs to happen after we've set + triviality flags appropriately for our bases. */ + if (cxx_dialect >= cxx0x) + deduce_noexcept_on_destructors (t); + /* Check all the method declarations. */ check_methods (t); diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted41.C b/gcc/testsuite/g++.dg/cpp0x/defaulted41.C new file mode 100644 index 0000000..4272012 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted41.C @@ -0,0 +1,14 @@ +// PR c++/56343 +// { dg-do compile { target c++11 } } + +class B +{ +public: + virtual ~B() noexcept(false) { } +}; + +class D : public B +{ +public: + virtual ~D() = default; +};