From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id B7E343858D35 for ; Tue, 14 Nov 2023 21:04:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B7E343858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B7E343858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699995895; cv=none; b=AEDfWLttAfaZx4b/1EeuItCmySPUXRRdzyC4NU3g0jn2l41cI74WVVEguEKXutI50xUyKPh0U7uSLdl2Q6gQKgQqwfoDfBx3y0rnDlj5qL7hEAn5i4fCb732kC1VkMAr4gSODNW9Mq+VYupOcA3fj+4yIGQXnJXff71JgDeuL+o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699995895; c=relaxed/simple; bh=k6FiTNbIFi/oy+3aH9IBI8TWtocShpXMfZLMRA/mm5g=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=wpxIHgxAyqZeDtBFMaWUrSkmIHLU+fi2smWfQxP5IYjQnxxaHpY1YGBr1bPMnvtr0NoX2+JZYc7WU8dEFHxGPQsGOFkYeiCPEECPYi4OLooo5cnxPHoax9tGeclap74U8efyPw9z8Wnh2r/AKEmw8A+XtxSAuhGAxrSnzTid11c= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699995891; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=D1X+ozh9FraElpLqzK2SUvjZe4fYlEAQ4uxoZXCIcww=; b=BAqowTK5STJUGovbWXyl2vNhtU4pKMKXCoqWVJbLUlhBEu7CaigHnuLIXV51OWZ9eYzjXu /SqXIsSZqlVAtvIhKNPVirDoH6O+TZ21hzYvPMGBZ/ojQ82mAncM38Uzd9DQewwHdzGIpR e3HRPhjRW/TZ3moEYBpRUKJ5JeXl6Pw= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-332-h2C5coHXPfikpYSlNU5Jmg-1; Tue, 14 Nov 2023 16:04:50 -0500 X-MC-Unique: h2C5coHXPfikpYSlNU5Jmg-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-77bc625a8a2so618169385a.0 for ; Tue, 14 Nov 2023 13:04:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699995889; x=1700600689; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=D1X+ozh9FraElpLqzK2SUvjZe4fYlEAQ4uxoZXCIcww=; b=msRLPf6TZ4MH3xlpqnOm/ETzoe/zox4wjdXH5B/0NA4IyUDhtUiHQsMxSRsPe5Qd16 nA/YiDXivRFLwdMse4gtgKwkXQZXQH405UuCx5XvuT/Wuixd/0UU1kMuSmtMugIaDBxG FO6ZEmFDpN6qsIsPEZJTesZHDn5MisNaHlYr8mJGUCyevrEs0BZ8ONGV6jNX5JS5cZ5t e6Af9KSqMWjQMjBfNfNxHzsP+yU09OVzDYZgA2fPi0Y0PWbTjKI8xM++X1qghYrXZuIK qFhfRDcC1AXXDsH3b+UVZHUvVgMQynnHyo1lwvHTqyv4sldcbJRDTntWj48uFBPgL416 ngCQ== X-Gm-Message-State: AOJu0Ywd3gdGf1kXTbcoDklhKfQTlVYi4NPWQkeFpodeJ44dYp9xAbV1 t8PFocsizmQQNsZhdmUjhZKWjAdgYZoB8j45ipfyH693jRVFSgja2jeXUpZCdMTiV/Fv5Byn7Ee lOQrNOWwatKEsGWPZ4J2frqif7tr0go13PUyZsx8W34SMUTFDHpv7wRILY+K25SRfh9oMizSNco 4= X-Received: by 2002:a05:620a:1201:b0:778:9156:3f07 with SMTP id u1-20020a05620a120100b0077891563f07mr3424215qkj.24.1699995889179; Tue, 14 Nov 2023 13:04:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IGH9jDHOzfrshDvTqoPxRnqB8ylfpEnc2U+fqzMP265cFuXizZdqMvOMa5e3taciPsGqZeBaw== X-Received: by 2002:a05:620a:1201:b0:778:9156:3f07 with SMTP id u1-20020a05620a120100b0077891563f07mr3424193qkj.24.1699995888762; Tue, 14 Nov 2023 13:04:48 -0800 (PST) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id rg8-20020a05620a8ec800b00765ab6d3e81sm2913514qkn.122.2023.11.14.13.04.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 13:04:48 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com, Patrick Palka Subject: [PATCH] c++: partially inst requires-expr in noexcept-spec [PR101043] Date: Tue, 14 Nov 2023 16:04:45 -0500 Message-ID: <20231114210445.1469279-1-ppalka@redhat.com> X-Mailer: git-send-email 2.43.0.rc1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- Here we're ICEing from strip_typedefs for the partially instantiated requires-expression when walking its REQUIRES_EXPR_EXTRA_ARGS since it's a TREE_LIST with non-empty TREE_PURPOSE (to hold the captured local specialization 't' as per build_extra_args) which strip_typedefs doesn't expect. We can probably skip walking REQUIRES_EXPR_EXTRA_ARGS at all since it shouldn't contain any typedefs in the first place, but it seems safer and more generally useful to just teach strip_typedefs to handle non-empty TREE_PURPOSE the obvious way. (The handling asserted TREE_PURPOSE was empty ever since inception i.e. r189298.) PR c++/101043 gcc/cp/ChangeLog: * tree.cc (strip_typedefs_expr) : Handle non-empty TREE_PURPOSE. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-requires37.C: New test. --- gcc/cp/tree.cc | 19 ++++++++++++------- .../g++.dg/cpp2a/concepts-requires37.C | 11 +++++++++++ 2 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-requires37.C diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc index dc4126f935c..0736e8d8f48 100644 --- a/gcc/cp/tree.cc +++ b/gcc/cp/tree.cc @@ -1911,19 +1911,24 @@ strip_typedefs_expr (tree t, bool *remove_attributes, unsigned int flags) case TREE_LIST: { bool changed = false; - releasing_vec vec; + auto_vec vec; r = t; for (; t; t = TREE_CHAIN (t)) { - gcc_assert (!TREE_PURPOSE (t)); - tree elt = strip_typedefs (TREE_VALUE (t), - remove_attributes, flags); - if (elt != TREE_VALUE (t)) + tree purpose = strip_typedefs (TREE_PURPOSE (t), + remove_attributes, flags); + tree value = strip_typedefs (TREE_VALUE (t), + remove_attributes, flags); + if (purpose != TREE_PURPOSE (t) || value != TREE_VALUE (t)) changed = true; - vec_safe_push (vec, elt); + vec.safe_push ({purpose, value}); } if (changed) - r = build_tree_list_vec (vec); + { + r = NULL_TREE; + for (int i = vec.length () - 1; i >= 0; i--) + r = tree_cons (vec[i].first, vec[i].second, r); + } return r; } diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-requires37.C b/gcc/testsuite/g++.dg/cpp2a/concepts-requires37.C new file mode 100644 index 00000000000..72dad77fea1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-requires37.C @@ -0,0 +1,11 @@ +// PR c++/101043 +// { dg-do compile { target c++20 } } + +template +void f(T t) { + [&](auto) noexcept(requires { { t.g() }; }) { }(0); +} + +int main() { + f(0); +} -- 2.43.0.rc1