From patchwork Fri Oct 1 20:10:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1535535 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=AKwbOWmc; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HLhZG5TxLz9t25 for ; Sat, 2 Oct 2021 06:30:29 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6113B3857014 for ; Fri, 1 Oct 2021 20:30:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6113B3857014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1633120226; bh=XC9DDoJuvYrumNdQSlFrhMCrNeVkbyjZZpq023huzE0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=AKwbOWmcMxhVzpDYKUEiR+fhXPZK4alfmHoGpf/UVUUvsh59DZhRJ2vsEWOKuwXvr BVTdVCkBm0V2QAPjl07KlD2Fx3sV07kSfr5trVgGplD5/CtYtFRctdhrv0PRV+uAuF +8LkR1Q6ZKFWygTltdmpQK51Muy2LExgQzXD3zpM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id A4EC5385783E for ; Fri, 1 Oct 2021 20:10:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A4EC5385783E Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-173-BV4_4WCPNUefFyOYiiuoqg-1; Fri, 01 Oct 2021 16:10:26 -0400 X-MC-Unique: BV4_4WCPNUefFyOYiiuoqg-1 Received: by mail-qv1-f70.google.com with SMTP id g15-20020ad457af000000b0038266dd4333so14165407qvx.10 for ; Fri, 01 Oct 2021 13:10:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XC9DDoJuvYrumNdQSlFrhMCrNeVkbyjZZpq023huzE0=; b=YIgKKaMnpgQGe0cfQYd/MA2mUopiCXfoNFjckg7A9PLuQNZH7bbJas9qBgWm+htoTJ U7BVfMcHJS9MSht6oVLB2SHP99+zzko1XsOcjDQkf6KFTvFSJcvyoBU516Uol0unIVpv opyfOmIm1PrDQ6KATKpnv2YMKMQOL0cHOolK0sQXoSVGQPPm7UDh6v1Awc5JYsTLhh89 jax6AKByUkNLMs1KdXcUolV7db+omeKrd4bhGgXen62fuBhYA6gpI+m3FH4mVWVXcyrQ nd+IJi2AmX0iqjnGLLJuh1UmepFOqGCrHCAzK0Z+r9VPuj+c/28z/7Q4XVpUBvyVIWjQ A9Sw== X-Gm-Message-State: AOAM532ekgRUgybQ8kTVrCUMJ40VegKwKNPvRjQHeokriAXkNfxPDnj/ k4NWfw7Ev31og9JzL5gXklAaG0l6j9urt0Iy7m56+5hiOvQkoBQQCslsLKIJw2pcNHY+YyYSsyd Dg2wWFehUhh9ZfVOTTIduvKVoWeG3fBzgn4vvrHzSe1JF5DIIdoFM0YjpokZ4aHvC1Eg= X-Received: by 2002:ac8:5a:: with SMTP id i26mr15220237qtg.269.1633119025797; Fri, 01 Oct 2021 13:10:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxF1NIe7Hde9/U2jpJaDKwjCS7qXO1AdnASqy2Or7Mm58bnnx71oU3sN0MRAiRB4R23+qpnNg== X-Received: by 2002:ac8:5a:: with SMTP id i26mr15220204qtg.269.1633119025478; Fri, 01 Oct 2021 13:10:25 -0700 (PDT) Received: from localhost.localdomain (ool-457d493a.dyn.optonline.net. [69.125.73.58]) by smtp.gmail.com with ESMTPSA id h17sm4490322qth.42.2021.10.01.13.10.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 13:10:25 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH] c++: ttp variadic constraint subsumption [PR99904] Date: Fri, 1 Oct 2021 16:10:22 -0400 Message-Id: <20211001201022.2678056-1-ppalka@redhat.com> X-Mailer: git-send-email 2.33.0.610.gcefe983a32 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-15.7 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_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Patrick Palka via Gcc-patches From: Patrick Palka Reply-To: Patrick Palka Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Here we're crashing when level-lowering the variadic constraints on the template template parameter TT because tsubst_pack_expansion expects processing_template_decl to be set during a partial substitution. bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk/11? Also tested on cmcstl2 and range-v3. PR c++/99904 gcc/cp/ChangeLog: * pt.c (is_compatible_template_arg): Set processing_template_decl around tsubst_constraint_info. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-ttp4.C: New test. --- gcc/cp/pt.c | 2 ++ gcc/testsuite/g++.dg/cpp2a/concepts-ttp4.C | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-ttp4.C diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1dcdffe322a..f950f4a21b7 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8223,8 +8223,10 @@ is_compatible_template_arg (tree parm, tree arg) { tree aparms = DECL_INNERMOST_TEMPLATE_PARMS (arg); new_args = template_parms_level_to_args (aparms); + ++processing_template_decl; parm_cons = tsubst_constraint_info (parm_cons, new_args, tf_none, NULL_TREE); + --processing_template_decl; if (parm_cons == error_mark_node) return false; } diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-ttp4.C b/gcc/testsuite/g++.dg/cpp2a/concepts-ttp4.C new file mode 100644 index 00000000000..cf3e71ea974 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-ttp4.C @@ -0,0 +1,9 @@ +// PR c++/99904 +// { dg-do compile { target c++20 } } + +template concept C = (Ts::value && ...); +template requires C struct A; +template requires true struct B; +template requires C class TT> struct S; +using ty1 = S; +using ty2 = S; // { dg-error "constraint" } TT's constraints don't subsume B's