From patchwork Mon Mar 28 13:30:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 1610163 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=rLd7nAhL; 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 4KRtsX1Zddz9sDX for ; Tue, 29 Mar 2022 00:32:15 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E6F97385803D for ; Mon, 28 Mar 2022 13:32:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E6F97385803D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1648474332; bh=KvJmxAi4KmvzwrfxWTf06LNcJUD5H5WEheWpL0y1PSc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=rLd7nAhLM/9Ai4BpMUz/xNBYBK4CZsrJDRCM40ejIlkStiPUXXdfeC+agfMctzA4d hmQ6gT8tTDc1ABi8fpKZIKCYBA1xYh1TjyMe3tzEDYjAS9cYlAoKMkfogFSiS9UGUi pJxQHcxXj/vSIIHRK9cIqlr6ubkVCzQPtzqqRzLg= 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 [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E16C23857831 for ; Mon, 28 Mar 2022 13:30:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E16C23857831 Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-518-De0Oll3XOfaP1M7Oxt3WRQ-1; Mon, 28 Mar 2022 09:30:27 -0400 X-MC-Unique: De0Oll3XOfaP1M7Oxt3WRQ-1 Received: by mail-qt1-f197.google.com with SMTP id m12-20020ac807cc000000b002e05dbf21acso12147004qth.22 for ; Mon, 28 Mar 2022 06:30: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:subject:date:message-id:mime-version :content-transfer-encoding; bh=KvJmxAi4KmvzwrfxWTf06LNcJUD5H5WEheWpL0y1PSc=; b=VDDwWtwsdRblbKKAoEPPc2+ewgMYVzkim8m4XRvvfKFdDbX8q71zpOrdmSL6W/JrRv C11pd6xylETu2093qX2oiE5Ky4N0XNuC2YmeMQMkKxRMreLuzB9QFAajYDKLdT1Hgiyw M/X0j1owTfAsCqk4jPOl2m7hyzYBMvSUKHNTcO8JBCLBn/0BHyeBj+S6j1eqbPTRf20m CZvZmJDzdYBaXngl6JdYPWSpeeV7V4m3J10F6fweW/WaGb90zuaQL1nzUVBPExxuNAbL QARYC+uZ1bdRajPCiXNJqkTIPSbYPjDhEcEKKYErbxj/TR8LYnHAi2kPfcEhKLidLhC+ AjTA== X-Gm-Message-State: AOAM531cVA1P0JGSAOilspufEEq8/Y2vaVMuxK6WMWD9gU56PeIGp1Nb zgEW7tTwnnIPNYfhF4nT5gi+gdLxXatglgc7ZHJdseKxVtvqgMcQyTLEMW2m5LQavRXcx6tTQ24 IbcAGjtu+cjCD/wHDJYHeVo38D1u+VJSk10Q3iiltm7PoyJHvB9qR3nwO+g02A1fOng== X-Received: by 2002:a37:a817:0:b0:67b:6ea0:5e9a with SMTP id r23-20020a37a817000000b0067b6ea05e9amr16000261qke.386.1648474224960; Mon, 28 Mar 2022 06:30:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIq3dcZudDMTi2EDeK+IRgP6vbM44+bzO1gW17IMALSY6Z24Tl4C1Zncjvlx6rGfW/JWH5QQ== X-Received: by 2002:a37:a817:0:b0:67b:6ea0:5e9a with SMTP id r23-20020a37a817000000b0067b6ea05e9amr16000224qke.386.1648474224523; Mon, 28 Mar 2022 06:30:24 -0700 (PDT) Received: from barrymore.redhat.com (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id f19-20020a05620a409300b00680c933fb1csm3198980qko.20.2022.03.28.06.30.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 06:30:23 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [pushed] c++: ICE with alias in pack expansion [PR103769] Date: Mon, 28 Mar 2022 09:30:20 -0400 Message-Id: <20220328133020.2576964-1-jason@redhat.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.5 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_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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: Jason Merrill via Gcc-patches From: Jason Merrill Reply-To: Jason Merrill Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This was breaking because when we stripped the 't' typedef in s...> to be s, the TYPE_MAIN_VARIANT of "Args..." was still "t...", because type pack expansions are treated as types. Fixed by using the right function to copy a "type". Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/99445 PR c++/103769 gcc/cp/ChangeLog: * tree.cc (strip_typedefs): Use build_distinct_type_copy. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/variadic-alias5.C: New test. --- gcc/cp/tree.cc | 2 +- gcc/testsuite/g++.dg/cpp0x/variadic-alias5.C | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-alias5.C base-commit: bc86a86a4f2c057bc0e0be94dcbb8c128ae7f717 diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc index eb59e56610b..492921721f2 100644 --- a/gcc/cp/tree.cc +++ b/gcc/cp/tree.cc @@ -1791,7 +1791,7 @@ strip_typedefs (tree t, bool *remove_attributes, unsigned int flags) Ts pack, resulting in an error. */ if (type != pat && uses_parameter_packs (type)) { - result = copy_node (t); + result = build_distinct_type_copy (t); PACK_EXPANSION_PATTERN (result) = type; } } diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-alias5.C b/gcc/testsuite/g++.dg/cpp0x/variadic-alias5.C new file mode 100644 index 00000000000..70956c91838 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-alias5.C @@ -0,0 +1,9 @@ +// PR c++/103769 +// { dg-do compile { target c++11 } } +// { dg-additional-options "--param=hash-table-verification-limit=1000" } + +template using t = T; +template struct s {}; +template s...> f() { return {};} + +int main() { f(); }