From patchwork Wed Jun 12 18:49:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1947081 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=ddReFQHC; 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 4Vzvk71Qgyz20Pb for ; Thu, 13 Jun 2024 04:50:23 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7F798388210D for ; Wed, 12 Jun 2024 18:50:20 +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 36CDB3882061 for ; Wed, 12 Jun 2024 18:50:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 36CDB3882061 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 36CDB3882061 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=1718218202; cv=none; b=fSOIfD3pBiXQ/dQPbWu2EZatNSs5Kt2Hr6gWNJY22yon+k4SAib5WhvnKGdHfcpzaMWifZrBXTI9Ze3CwROsnozcv1gRxIDKDyAf9oGT3fRnBV2nQqDe6mwSxBXohRF7a/aI5H2bhKHRO8qzLBDElm3aRsKUB0LxKy6H6u+oROA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718218202; c=relaxed/simple; bh=FvkG91WZSo+P2Sz/9kpeZQ9t6SiADEAJxwJV2l89izs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ZSllgqBm8tvqI4a31iTGglCirg9WVFelkeiWxKvcgUd+deDVBExpH7gMUssPn3PGjm7+uo5MdO0AyrHJ8Vu6ppq7+WRduZ4u4tXZo60nynXPYakJ3niAm7Oy0/I9t+RH2jtVeP1ZHx5YfRMmPehXDMzsJz4OV8M7UPSLLu8J24U= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718218200; 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=//1J0pP+v2DNwsN/m67GdGNdGzJV8xiucAUCHcxbzUs=; b=ddReFQHCEFNArkR6Ys1+ROyZdsgmasrUPAodPnefzfUt9A24gu9ZSTB5RU3KnU71f4Wa32 ROUTqoPP6DYVykbwV1A/qdjD+b549YbO6b2zUqxw6WFwTQRUvGQRUnf7YwublgIfHAAXwf G1Ow7TspItdPQ/FGI8iUffYR3BI4K1w= Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-504-vfurH3tGPpyLX5_f_qIsbA-1; Wed, 12 Jun 2024 14:49:57 -0400 X-MC-Unique: vfurH3tGPpyLX5_f_qIsbA-1 Received: by mail-ot1-f72.google.com with SMTP id 46e09a7af769-6fa1038e5cdso118769a34.3 for ; Wed, 12 Jun 2024 11:49:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718218196; x=1718822996; 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=//1J0pP+v2DNwsN/m67GdGNdGzJV8xiucAUCHcxbzUs=; b=qgbrDRNy/5CSG9dWV5pl6JXhI8DCZA8pUQtpL8tyRTxExovezdam9PA2PJO3z/b1yF GvvJsr6/C+1uMpL4xkgyZTfEztwP4eFfPQUFjpm5G077z6RDdA1KNGa9EElvz4zuvsfp H6odOJnuKQYRx1thLhxuuECKVIy2YRK5/aO4UWd05h5Nv81J//ujYwnE3bpzSkRPXbKl BUoG7NyGBE9TNrzgMfxyQVLCp9LQfRORzij5TLVh+qyWhSsdfXAENG8VhIqu3cgsXzRi 9mkGx6PnBWKAq+IT6zDlSqk/0bLQL5vVJiPYwiCg8t3mb/WAWBrRs7/w6fMd5lrYGOJZ 0gWQ== X-Gm-Message-State: AOJu0YzK1YWhuhsSEkEWRoB1/wbuKiKtjfhOV93Ir2jj7W0728CWi0G6 kVy3K/+oihvxKNwXHJhT+lthWuHHu+E3XPisw+jAJnsKZmpV2jXDFXonAoM6ADgPjPN/5EqLbYM hxusTVHDDQo0F03/NE6kmHSNhi+ZooECWTrlDDR5jMD646xAvgKO/O6p0R1uQpVYuua5PEo7x4L p6fb4piPtFmm0ll4vExkq3JNJODKF590FIvqDP X-Received: by 2002:a9d:7f1a:0:b0:6f9:7918:844e with SMTP id 46e09a7af769-6fa1b93d562mr2843627a34.0.1718218196264; Wed, 12 Jun 2024 11:49:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE55HLmS4prE+UF+8XouUwy420pACjBg0oec10/wNLtDfU0z0z2ydpoqeJshcmOawgBH27Log== X-Received: by 2002:a9d:7f1a:0:b0:6f9:7918:844e with SMTP id 46e09a7af769-6fa1b93d562mr2843574a34.0.1718218195707; Wed, 12 Jun 2024 11:49:55 -0700 (PDT) Received: from localhost.localdomain (ool-18bb2a2e.dyn.optonline.net. [24.187.42.46]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7960149687csm295793285a.92.2024.06.12.11.49.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 11:49:55 -0700 (PDT) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com, Patrick Palka Subject: [PATCH] c++: visibility wrt concept-id as targ [PR115283] Date: Wed, 12 Jun 2024 14:49:53 -0400 Message-ID: <20240612184953.2734787-1-ppalka@redhat.com> X-Mailer: git-send-email 2.45.2.457.g8d94cfb545 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.4 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_H4, 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 -- It seems we don't maintain visibility flags for concepts either, so min_vis_expr_r should ignore them for now, otherwise after r14-6789 we incorrectly give function templates that use a concept-id in their signature internal linkage. PR c++/115283 gcc/cp/ChangeLog: * decl2.cc (min_vis_expr_r) : Ignore concepts. gcc/testsuite/ChangeLog: * g++.dg/template/linkage5.C: New test. --- gcc/cp/decl2.cc | 5 +++-- gcc/testsuite/g++.dg/template/linkage5.C | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/template/linkage5.C diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc index 7baff46a192..88e87ad60c6 100644 --- a/gcc/cp/decl2.cc +++ b/gcc/cp/decl2.cc @@ -2723,9 +2723,10 @@ min_vis_expr_r (tree *tp, int */*walk_subtrees*/, void *data) break; case TEMPLATE_DECL: - if (DECL_ALIAS_TEMPLATE_P (t)) + if (DECL_ALIAS_TEMPLATE_P (t) || concept_definition_p (t)) /* FIXME: We don't maintain TREE_PUBLIC / DECL_VISIBILITY for - alias templates so we can't trust it here (PR107906). */ + alias templates so we can't trust it here (PR107906). Ditto + for concepts. */ break; t = DECL_TEMPLATE_RESULT (t); /* Fall through. */ diff --git a/gcc/testsuite/g++.dg/template/linkage5.C b/gcc/testsuite/g++.dg/template/linkage5.C new file mode 100644 index 00000000000..1dbb0beb5ea --- /dev/null +++ b/gcc/testsuite/g++.dg/template/linkage5.C @@ -0,0 +1,14 @@ +// PR c++/115283 +// { dg-final { scan-assembler "(weak|glob)\[^\n\]*_Z1fIiEv1AIX4sameIT_EEE" } } +// { dg-do compile { target c++20 } } + +template +concept same = true; + +template +struct A { }; + +template +void f(A>) { } + +template void f(A);