From patchwork Fri Nov 24 18:09:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1868264 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=GSOAMhFn; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4ScNL62dNDz1ySk for ; Sat, 25 Nov 2023 05:09:50 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BDE843858295 for ; Fri, 24 Nov 2023 18:09:47 +0000 (GMT) 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 656223858CD1 for ; Fri, 24 Nov 2023 18:09:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 656223858CD1 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 656223858CD1 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=1700849376; cv=none; b=lMdJotTFDfRFRlCQAZ+slM96BzAZGoJ0kwhfxU0y+bpOHZWHmU6U1326B5hqcrlzVagBGSbBVfuNGCZ4jBdpQ1ZBg9hZUsncug8Q5zuVqpoSzmymoNDt3Hpl1OWYmfVJMwQr3U3MnpRHxNIGIKRYUeSOkOaiTu5GVno+LtnaPwY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700849376; c=relaxed/simple; bh=cufvXokMBmOA3J3Z8J+pOIxOuLQDSoMUhL7CukFo+Co=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=qB9wLDvsDV7u9cH0z588fmIELISYXI0bjj4bWy0mKR+z0BSmVx18HclWnRiWGGV4pN+kQM49Eb3RI4S4HudV9Q4ADinEzMzVxD1nzcfrPNcIAuBAqUvXuxcIb6UoIIMgO4JtnTira1vEhvTDcjzHJsW0gPZLOWmobd1GrtyExPQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700849375; 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=7CQBYDM+YwC1y/S8kCw1hU3TvEwWqZh/PEqMok5/ev4=; b=GSOAMhFnA5kDWXhfH0tBprphmdf17fjyTZD2uC+neU3OMJrJITZPqppmUm+ifP30OrRFyQ hU8odz/L5WxBwL/doJMO6iUBTVDyP99B6u7083vtjc7kSSuEonjfVaJN0hby98IQg1Qqrb KfvuZN+XOIs+TG/ElbwA/tMv9/q7myc= 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-604-ipfCkAwRORi-xvHlid41_Q-1; Fri, 24 Nov 2023 13:09:33 -0500 X-MC-Unique: ipfCkAwRORi-xvHlid41_Q-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-77d69e3dd18so240874985a.0 for ; Fri, 24 Nov 2023 10:09:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700849372; x=1701454172; 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=7CQBYDM+YwC1y/S8kCw1hU3TvEwWqZh/PEqMok5/ev4=; b=IsUSguVFZsebzdaK84vNyFQR5INFBymAWIbnp+iL4JOwIC9i7kpFjlVe/WkgrztCwe +1iccBiGlGS9oqEBa/G5S5yNSg0a2b9vC8CApJKqA4SA+qz3DOFfcvga5p44ldxHKELj D1OEILot+zSLd4IJRRICFgWXuSbV/LqxsRAf0uRluyDJ1edySnz6BMXNd+XTPHVqhH2N E8D7BYaYZFDcZgoBuetycs04e8HNK5c9m41+of4dHgM8GXqprjqRg/vd7DZ2VbuFLqQQ /GVdJepPO/ueRnvCEhQnT9kUfh7ZCXfsM6wO6uuTH03MwtGcMQNtcXP6/ZvWfWvoWPvp yuqQ== X-Gm-Message-State: AOJu0YzNztmHJFwskZRqTxP1JJ6614syvz0ZbebVSU+6Z042bUvFI8Tu ZHlQjnw8N4vs6NXeZNAEm8wvfUWOoIln8RmgK1mlc/P2xbW2bZeTYsh2odWZvZ+LJjqxYqonk0B N91xasbextIXBuwM/952NIHp0whXlcHbH/KMx0rKfoNIOMErAQEcdNgcNLix+T6cnw18WmI1KKt c= X-Received: by 2002:a05:620a:8cd:b0:777:dd5:6045 with SMTP id z13-20020a05620a08cd00b007770dd56045mr3700459qkz.73.1700849371846; Fri, 24 Nov 2023 10:09:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTYfKbJlmKzJt7bqEU+rX/HgeMeYc9XZOJRrETBKHYeJXDOtqlpPrzOLYDKge9Bmk9eeWRDg== X-Received: by 2002:a05:620a:8cd:b0:777:dd5:6045 with SMTP id z13-20020a05620a08cd00b007770dd56045mr3700428qkz.73.1700849371495; Fri, 24 Nov 2023 10:09:31 -0800 (PST) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id g12-20020a05620a13cc00b0077580becd52sm1384065qkl.103.2023.11.24.10.09.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 10:09:31 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com, nathan@acm.org, Patrick Palka Subject: [PATCH] c++/modules: alias CTAD and specializations table Date: Fri, 24 Nov 2023 13:09:22 -0500 Message-ID: <20231124180922.1302655-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 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- A rewritten guide for alias CTAD isn't really a specialization of the original guide, so we shouldn't register it as such. This avoids an ICE in the below modules testcase which otherwise tries to inspect the rewritten guide's empty DECL_CONTEXT. It also preemptively avoids an ICE in modules/concept-6 in C++23 mode with the inherited CTAD patch. * pt.cc (alias_ctad_tweaks): Pass use_spec_table=false to tsubst_decl. gcc/testsuite/ChangeLog: * g++.dg/modules/concept-8.h: New test. * g++.dg/modules/concept-8_a.H: New test. * g++.dg/modules/concept-8_b.C: New test. --- gcc/cp/pt.cc | 3 ++- gcc/testsuite/g++.dg/modules/concept-8.h | 14 ++++++++++++++ gcc/testsuite/g++.dg/modules/concept-8_a.H | 5 +++++ gcc/testsuite/g++.dg/modules/concept-8_b.C | 8 ++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/modules/concept-8.h create mode 100644 gcc/testsuite/g++.dg/modules/concept-8_a.H create mode 100644 gcc/testsuite/g++.dg/modules/concept-8_b.C diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 4f93150c5d7..2cfe1da5e07 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -30015,7 +30015,8 @@ alias_ctad_tweaks (tree tmpl, tree uguides) /* 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); + g = tsubst_decl (DECL_TEMPLATE_RESULT (f), targs, complain, + /*use_spec_table=*/false); } if (g == error_mark_node) continue; diff --git a/gcc/testsuite/g++.dg/modules/concept-8.h b/gcc/testsuite/g++.dg/modules/concept-8.h new file mode 100644 index 00000000000..a25f9b752fd --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/concept-8.h @@ -0,0 +1,14 @@ +// A version of concept-6.h using an alias template + alias CTAD + +template +struct Base +{ + Base (const _Callable &) + requires true + {} +}; + +template requires true +using Derived = Base<_Callable>; + +inline Derived all = [] (auto&& __r) {}; diff --git a/gcc/testsuite/g++.dg/modules/concept-8_a.H b/gcc/testsuite/g++.dg/modules/concept-8_a.H new file mode 100644 index 00000000000..da0467781c1 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/concept-8_a.H @@ -0,0 +1,5 @@ +// { dg-require-effective-target c++20 } +// { dg-additional-options "-fmodule-header -fconcepts" } +// { dg-module-cmi {} } + +#include "concept-8.h" diff --git a/gcc/testsuite/g++.dg/modules/concept-8_b.C b/gcc/testsuite/g++.dg/modules/concept-8_b.C new file mode 100644 index 00000000000..9a9f014ee09 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/concept-8_b.C @@ -0,0 +1,8 @@ +// { dg-require-effective-target c++20 } +// { dg-additional-options "-fmodules-ts -fconcepts -fdump-lang-module-alias -fno-module-lazy" } + +#include "concept-8.h" +import "concept-8_a.H"; + +// { dg-final { scan-lang-dump-times {named merge key \(matched\) function_decl:'::Base<::._anon_0>::__ct '} 2 module } } +// { dg-final { scan-lang-dump-not {merge key \(new\)} module } }