From patchwork Wed Jun 12 20:30:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 1947115 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=gHb4SKHl; 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 4VzxyV3RlDz20Pb for ; Thu, 13 Jun 2024 06:31:14 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B6807388215C for ; Wed, 12 Jun 2024 20:31:12 +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.129.124]) by sourceware.org (Postfix) with ESMTPS id 76BC43882061 for ; Wed, 12 Jun 2024 20:30:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 76BC43882061 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 76BC43882061 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718224247; cv=none; b=vfIib7riKtdKAocf1JMn+KEWogDKdvvAGf/q7nCOh4EYaSMucQTQlH8+JsZM89lqUgxknGSySYJLtrUmlki5UkTweyYt2rV1gllJU1OrACM6iDMDLC6HNAnOkThyMCEnIv7IEBVbe6WFwKk5s+BWXgpdfHsryPueiOvjSAfmYVQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718224247; c=relaxed/simple; bh=Pn37zIT2Ymav7eAC4y0SGJd1c4RagAZ3VrnoOjuPCNU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=W96r7GSj7IC8tNv9PLE5nm00lsCNyJaxaME1q2pxfgBgABTjLzeGItpzBjkm/eDh5H73TEwFrvlnowOcArb7/2oJ7ef1ZdWAejjuI6YCmwio0Nna1YAw0PU+ZNIy4Qj2FGffOY+pkSYC+5pL36EtgQe9s3G77fkBDn5uxYQwQrc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718224244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ehu2jD+aPUV8utNlPNaKJhY4mUQbPvqJVOanwPS14jU=; b=gHb4SKHlcQYJqYgnpFzVaYRPbt0M2x5iFc0cWmAEA8E5xuqvzmg+CCzgfwaDkd07Ii9tEl EKWZgauQzWuGB8thDwV12WYnlowj7UR3/yv48G/dHzK/PKRWuDTrocLi/VZeSq3nL7D5e5 +SQflCRwUl1NGqiEKzaswz8Et/SSEvY= 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.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-185-8O27bIDpN2-gK3Mc0AQqzg-1; Wed, 12 Jun 2024 16:30:42 -0400 X-MC-Unique: 8O27bIDpN2-gK3Mc0AQqzg-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-4404d088c36so2283851cf.0 for ; Wed, 12 Jun 2024 13:30:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718224241; x=1718829041; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Ehu2jD+aPUV8utNlPNaKJhY4mUQbPvqJVOanwPS14jU=; b=r+Nn95A8G8t+3lhTAwmmr84GdHZpRNllUhZYZIoF7yVI3GZQVr85q9/KyFFrk3QzGU l+dBzLc0OLAEq2M5kkXYt8sX4YcQCgnhpKmwtgqlUTUcgt7YJQOizkLgoARhhqJ1NM8b dtJC+mnGH+LrNrtcP0gPKU/kgi++xpLCENbRaf5B+PM5THFm8OCJNQpIlOjwVzbulnDK 7CPHMPBwCudb7VapVfo0hUPNM0FGiqXFOL9YrzcLSlzoDl56jYhPO24KwNMW2oC9al4A /X/jeYyJZUgEWQ1v2oZFUP6qcPpln2/N1wbYahgZIdKW+gAkO92GXh2ut4F+HpNxYKe6 VhsA== X-Gm-Message-State: AOJu0YzkiY4assVeDY0k/CmR9j8vhlwsC9Iciq988s6iEJZgds4X3v1H +XK5gIEI3guV0fbPF0rszJ+LYmuMVzaLievgvQA7pKH0uxT+dXPp5tNKhaxqjLQyw3L3LiHK0Zm gkfNntVL9xps1KDY/s0iCQuA6b3888q4IR/6hVdmhSjgUPJXUDhiuc3jxp6jETrqiNhBz/BCP3K SEBM2L09yg3OOj0OPHGgJ61wOFt9k/4IRGFn8= X-Received: by 2002:ac8:5807:0:b0:440:5a87:2e06 with SMTP id d75a77b69052e-4415abdce88mr34472311cf.22.1718224241619; Wed, 12 Jun 2024 13:30:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG97XNE8vS5LJ31iQMnoFANLe/wS92ni12uoAEf8urHSoRC3YS6ZLQpAp/bApFXqA6xzsoghA== X-Received: by 2002:ac8:5807:0:b0:440:5a87:2e06 with SMTP id d75a77b69052e-4415abdce88mr34472041cf.22.1718224241098; Wed, 12 Jun 2024 13:30:41 -0700 (PDT) Received: from jason-thinkpadp1gen4i.rmtusma.csb (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-44057ffdbcbsm42906221cf.79.2024.06.12.13.30.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 13:30:40 -0700 (PDT) From: Jason Merrill To: gcc-patches@gcc.gnu.org Subject: [pushed] c++: module std and exception_ptr Date: Wed, 12 Jun 2024 16:30:30 -0400 Message-ID: <20240612203038.2524582-1-jason@redhat.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.3 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 Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- exception_ptr.h contains namespace __exception_ptr { class exception_ptr; } using __exception_ptr::exception_ptr; so when module std tries to 'export using std::exception_ptr', it names another using-directive rather than the class directly, so __exception_ptr is never explicitly opened in module purview. gcc/cp/ChangeLog: * module.cc (depset::hash::add_binding_entity): Set DECL_MODULE_PURVIEW_P instead of asserting. gcc/testsuite/ChangeLog: * g++.dg/modules/using-20_a.C: New test. --- gcc/cp/module.cc | 7 +++++-- gcc/testsuite/g++.dg/modules/using-20_a.C | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/modules/using-20_a.C base-commit: 7bf072e87a03c9eaff9b7a1ac182537b70f0ba8e diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 21fc85150c9..72e876cec18 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -13253,8 +13253,11 @@ depset::hash::add_binding_entity (tree decl, WMB_Flags flags, void *data_) data->met_namespace = true; if (data->hash->add_namespace_entities (decl, data->partitions)) { - /* It contains an exported thing, so it is exported. */ - gcc_checking_assert (DECL_MODULE_PURVIEW_P (decl)); + /* It contains an exported thing, so it is exported. + We used to assert DECL_MODULE_PURVIEW_P, but that fails for a + namespace like std::__exception_ptr which is never opened in + module purview; the exporting using finds another using. */ + DECL_MODULE_PURVIEW_P (decl) = true; DECL_MODULE_EXPORT_P (decl) = true; } diff --git a/gcc/testsuite/g++.dg/modules/using-20_a.C b/gcc/testsuite/g++.dg/modules/using-20_a.C new file mode 100644 index 00000000000..bb3bb6160f8 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/using-20_a.C @@ -0,0 +1,14 @@ +// { dg-additional-options "-fmodules-ts -fdump-lang-module -Wno-global-module" } +// { dg-final { scan-lang-dump {Writing definition '::foo::bar::baz'} module } } + +module; +namespace foo { + namespace bar { + struct baz { }; + } + using bar::baz; +} +export module foo; +namespace foo { + export using foo::baz; +}