From patchwork Thu Feb 14 23:23:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 1042481 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-496185-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="NKrieai0"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 440rn35R6pz9s3l for ; Fri, 15 Feb 2019 09:35:03 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=RwGxnbH4TRNY3ctnIfsP+T++vzRM5E+csuaFxiZYh5YxYqRUZ28se hu/g62yOOeJTnv9GxtEPCagyyv3OgNUB14bIzHo7j+9vugyuIVKztvEjjlor86vE /ns1dgOMXcSEMubnvuoFTuHAfCfQoIse2VFGJOaQ1Ql/aOl5wms4wk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; s= default; bh=OD//A2DVjexi+Qv+ATzlntPTi5E=; b=NKrieai0QWhO+6Z3vHYV xvU8BJmxcnsSrZI4Z1Pwhx1rORvGWs1Bylg0qrOvHvn05h2tI4DZ9G6IUYa7Q+x0 6mVt7LZtzH9BLUfolCq4LFVB7xmZxMT0cJ9aMJnNntqja+lSdaoDMUN2LPzDeBgx CXETcMBEutEUx7K+pQdXXRM= Received: (qmail 59879 invoked by alias); 14 Feb 2019 22:33:40 -0000 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 Received: (qmail 59518 invoked by uid 89); 14 Feb 2019 22:33:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=sk:decl_ma, sk:DECL_MA X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Feb 2019 22:33:30 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 31474C0ABF45 for ; Thu, 14 Feb 2019 22:33:29 +0000 (UTC) Received: from c64.redhat.com (ovpn-112-37.phx2.redhat.com [10.3.112.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D4765E7A8; Thu, 14 Feb 2019 22:33:27 +0000 (UTC) From: David Malcolm To: jakub@redhat.com, gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH 7/7] C++ concepts: fix ICE with requires on dtors (PR c++/89036) Date: Thu, 14 Feb 2019 18:23:44 -0500 Message-Id: <1550186624-25444-8-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1550186624-25444-1-git-send-email-dmalcolm@redhat.com> References: <1550186624-25444-1-git-send-email-dmalcolm@redhat.com> X-IsSubscribed: yes PR c++/89036 reports an ICE due to this assertion failing 1136 /* A class should never have more than one destructor. */ 1137 gcc_assert (!current_fns || via_using || !DECL_DESTRUCTOR_P (method)); on this template with a pair of dtors, with mutually exclusive "requires" clauses: template struct Y { ~Y() requires(true) = default; ~Y() requires(false) {} }; Nathan introduced this assertion as part of: ca9219bf18c68a001d62ecb981bc9176b0feaf12 (aka r251340): 2017-08-24 Nathan Sidwell Conversion operators kept on single overload set which, amongst other changes to add_method had this: /* A class should never have more than one destructor. */ - if (current_fns && DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (method)) - return false; + gcc_assert (!current_fns || !DECL_DESTRUCTOR_P (method)); The following patch drops the assertion. gcc/cp/ChangeLog: 2019-02-13 David Malcolm Backport of r268847 from trunk. PR c++/89036 * class.c (add_method): Drop destructor assertion. gcc/testsuite/ChangeLog: 2019-02-13 David Malcolm Backport of r268847 from trunk. PR c++/89036 * g++.dg/concepts/pr89036.C: New test. --- gcc/cp/class.c | 3 --- gcc/testsuite/g++.dg/concepts/pr89036.C | 8 ++++++++ 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/concepts/pr89036.C diff --git a/gcc/cp/class.c b/gcc/cp/class.c index d524a98..834ba17 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1141,9 +1141,6 @@ add_method (tree type, tree method, bool via_using) } } - /* A class should never have more than one destructor. */ - gcc_assert (!current_fns || !DECL_DESTRUCTOR_P (method)); - current_fns = ovl_insert (method, current_fns, via_using); if (!COMPLETE_TYPE_P (type) && !DECL_CONV_FN_P (method) diff --git a/gcc/testsuite/g++.dg/concepts/pr89036.C b/gcc/testsuite/g++.dg/concepts/pr89036.C new file mode 100644 index 0000000..f83ef8b --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/pr89036.C @@ -0,0 +1,8 @@ +// { dg-do compile { target c++11 } } +// { dg-options "-fconcepts" } + +template +struct Y { + ~Y() requires(true) = default; + ~Y() requires(false) {} +};