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 ESMTP id D07CA385DC02 for ; Thu, 15 Jul 2021 16:37:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D07CA385DC02 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-334-WiPjwbVqO3OlI5MmhR5Gcg-1; Thu, 15 Jul 2021 12:37:12 -0400 X-MC-Unique: WiPjwbVqO3OlI5MmhR5Gcg-1 Received: by mail-qt1-f200.google.com with SMTP id j16-20020ac855100000b029025bf786be09so4448098qtq.20 for ; Thu, 15 Jul 2021 09:37:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QXPUeueesiIW5pCKi+Q71egcgbK2j96XFEZz4y3Pa9U=; b=LrSQUvmisXxrHDJXzo4RcAyGKPAZQlqLFkNH78ByzzoBuwv01IEEIpFAin+bYnL5Ge 3Dr1pDKorZ40H0DIyAoZ6djtMlHb3elpZ2It6TxWVG+RfKPCBNVODUBqtCc8w6tLBgaw Z3Bjw0nQx6hklsg25d6mOpq6rx+E9xtMyQBsnwfkLNCWpQPWiw2CKstkx8JFASufFx8g Mato/qvXufTY70C22gVkCzU40+jVhhBAVywgz/uuE1YQBoZjhX+dQuV9o3pRGfk61l5N iawEy+MbMZhYcSS/8U3hpGruwmRreDwkGXeCU+yuXagwZsa+Ao7swcz1OT+UTjF136LY C3ng== X-Gm-Message-State: AOAM531jMm9TeOSHey1EnEt9XI3ThsP7ES0HvEVVFlFvETXNxF6ApBgx 5weOH5hmyxNQadl6AY7zwL2YDTcLlXOSHZGaFn2st878+8daMmrODzFMCXOSnYaizWQUF/g8Jps zPbEn8ovkEzwevJU21IoPalP1rLARs1dMl4sj43ddDYSJuO/MbDEOKXM+Eve2daZS06E= X-Received: by 2002:ac8:1389:: with SMTP id h9mr4780965qtj.173.1626367031812; Thu, 15 Jul 2021 09:37:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvaxvheHvwWRD3/ZeItM0ryHBo12owPi0DCo/ZJJ0FRm1cm61ZAIfsygpbJiAvwzKGBp35fA== X-Received: by 2002:ac8:1389:: with SMTP id h9mr4780949qtj.173.1626367031530; Thu, 15 Jul 2021 09:37:11 -0700 (PDT) Received: from localhost.localdomain (ool-457d493a.dyn.optonline.net. [69.125.73.58]) by smtp.gmail.com with ESMTPSA id z12sm2161089qtw.90.2021.07.15.09.37.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jul 2021 09:37:11 -0700 (PDT) From: Patrick Palka To: gcc-patches@gcc.gnu.org Subject: [PATCH] c++: alias CTAD inside decltype [PR101233] Date: Thu, 15 Jul 2021 12:37:08 -0400 Message-Id: <20210715163708.1707385-1-ppalka@redhat.com> X-Mailer: git-send-email 2.32.0.264.g75ae10bc75 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-Spam-Status: No, score=-16.1 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_H4, RCVD_IN_MSPIKE_WL, 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-List-Received-Date: Thu, 15 Jul 2021 16:37:15 -0000 This is the alias CTAD version of the CTAD bug PR93248, and the fix is the same: clear cp_unevaluated_operand so that the entire chain of DECL_ARGUMENTS gets substituted. Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk/11? PR c++/101233 gcc/cp/ChangeLog: * pt.c (alias_ctad_tweaks): Clear cp_unevaluated_operand for substituting DECL_ARGUMENTS. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/class-deduction-alias10.C: New test. --- gcc/cp/pt.c | 12 +++++++++--- gcc/testsuite/g++.dg/cpp2a/class-deduction-alias10.C | 10 ++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp2a/class-deduction-alias10.C diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c7bf7d412ca..bc0a0936579 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -29097,9 +29097,15 @@ alias_ctad_tweaks (tree tmpl, tree uguides) /* Substitute the deduced arguments plus the rewritten template parameters into f to get g. This covers the type, copyness, guideness, and explicit-specifier. */ - tree g = tsubst_decl (DECL_TEMPLATE_RESULT (f), targs, complain); - if (g == error_mark_node) - continue; + tree g; + { + /* Parms are to have DECL_CHAIN tsubsted, which would be skipped + if cp_unevaluated_operand. */ + cp_evaluated ev; + g = tsubst_decl (DECL_TEMPLATE_RESULT (f), targs, complain); + if (g == error_mark_node) + continue; + } DECL_USE_TEMPLATE (g) = 0; fprime = build_template_decl (g, gtparms, false); DECL_TEMPLATE_RESULT (fprime) = g; diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias10.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias10.C new file mode 100644 index 00000000000..a473fff5dc7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias10.C @@ -0,0 +1,10 @@ +// PR c++/101233 +// { dg-do compile { target c++20 } } + +template +struct A { A(T, U); }; + +template +using B = A; + +using type = decltype(B{0, 0}); -- 2.32.0.264.g75ae10bc75