Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2227932/?format=api
{ "id": 2227932, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2227932/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260424140504.1709726-1-ppalka@redhat.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/1.1/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null }, "msgid": "<20260424140504.1709726-1-ppalka@redhat.com>", "date": "2026-04-24T14:05:04", "name": "c++/modules+reflection: fix merging typedef struct { } A [PR124582]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "166b7937189ecec5d18dbbffa54bcfde830c0b03", "submitter": { "id": 78319, "url": "http://patchwork.ozlabs.org/api/1.1/people/78319/?format=api", "name": "Patrick Palka", "email": "ppalka@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260424140504.1709726-1-ppalka@redhat.com/mbox/", "series": [ { "id": 501373, "url": "http://patchwork.ozlabs.org/api/1.1/series/501373/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=501373", "date": "2026-04-24T14:05:04", "name": "c++/modules+reflection: fix merging typedef struct { } A [PR124582]", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501373/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2227932/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2227932/checks/", "tags": {}, "headers": { "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=Veahr957;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=Veahr957", "sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com", "sourceware.org; spf=pass smtp.mailfrom=redhat.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.133.124" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g2F9Q4JlPz1yD5\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 25 Apr 2026 00:05:45 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 3A1844BB58F3\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 14:05:43 +0000 (GMT)", "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by sourceware.org (Postfix) with ESMTP id 0ED304BA79A8\n for <gcc-patches@gcc.gnu.org>; Fri, 24 Apr 2026 14:05:16 +0000 (GMT)", "from mail-yw1-f197.google.com (mail-yw1-f197.google.com\n [209.85.128.197]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-638-1uH3nvdJNzSzbg7ni-cchw-1; Fri, 24 Apr 2026 10:05:13 -0400", "by mail-yw1-f197.google.com with SMTP id\n 00721157ae682-7b846af7e4fso9887717b3.2\n for <gcc-patches@gcc.gnu.org>; Fri, 24 Apr 2026 07:05:13 -0700 (PDT)", "from idea ([2600:4040:aa66:bf00:9e8e:99ff:fed1:71f])\n by smtp.gmail.com with ESMTPSA id\n af79cd13be357-8e7d8edb772sm1998373985a.27.2026.04.24.07.05.08\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 24 Apr 2026 07:05:08 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 3A1844BB58F3", "OpenDKIM Filter v2.11.0 sourceware.org 0ED304BA79A8" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 0ED304BA79A8", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 0ED304BA79A8", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777039516; cv=none;\n b=bovS5RgPw6W8gs2+geidSzmMf0AaKLdWvPQIR9Fd7nCDZcO9HwqUPwofUH+lZVICgSeDVcvT7P4Nmbv4/AJtQFMSb9UrZsx3wNdK44vbwfp7ZQz/zW1w5fVBcX7vacakFcMmzE7FrnDOvzhq70VBv596zS2BotMVMgfajRmQzGg=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777039516; c=relaxed/simple;\n bh=VI4Og6PvS4NBMfOwsfYz+fMc2okR/2is9ulYgO2mb9c=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=GMqRM1sCPx9EWMtBi4KGfKhxCSVrTbk49JzU5WFF+Zi56eCQsDYbHAUyYfmOdM7zcG41O8tTXTepL8nMQISAOtp4MZblkJvvk/2lFCJdhvhU+ip/LZZqE5iAPChDuwakvA/kJh/ygRm9k8zLMKuLHxrqtAAJpF1qXIMoWdAxNVo=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1777039515;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=MAyTmSp8cY2ogWEbdyxsdMD0FSSeJJdLdvVDJ0fqN+w=;\n b=Veahr957qvO3IwlXrKZMCfgXq+/i3DCQIqfviVJlO3wK9FT7jRqM7P6DQ0ebfe82Luwwg3\n hlwzv9Ia7uJDdX4/VefDoz1FlXuNBD/QTyROZxA8js188XGJRIfUC0iyfG+oQAeOqjqkKg\n RRNBMX3xKlkFU9E4Q8IpEHNuDADe1Qc=", "X-MC-Unique": "1uH3nvdJNzSzbg7ni-cchw-1", "X-Mimecast-MFC-AGG-ID": "1uH3nvdJNzSzbg7ni-cchw_1777039513", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777039511; x=1777644311;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=MAyTmSp8cY2ogWEbdyxsdMD0FSSeJJdLdvVDJ0fqN+w=;\n b=CePc3JIvQV4KA17JUD5U+6PLyHWAU/voJqRn8V3SSfX4DzTuWtgIGX5xD6JbkFtsJt\n PJsLM9lW5Nuksse1lQRvRRKvlouq9fTbezlWY9D5l/mxGB6yiHfzQMC+MoEiQYal2qAq\n ygY9co3czrtKi6Mot18Zo5CZ16o634jGhnw31Dvkx1p8IUm8RhHhIfyiEyYtWttKFk3I\n +TYLlX8FI/qLy7+XrzYZuwwN/PzW4OVB6cXxJpuoL7kktodtdzOtE4Vg5L+7DQg0P64F\n +UlQU7J3mG2BCJqEtV3r+6HLDVBpKXlR6809a/Bc9hzOATjuSFpWKj5ED/+DzfviszM1\n x1ww==", "X-Gm-Message-State": "AOJu0YzGEmhFaMXaxfwXivouuod3RpVNKpfDv+uOKWc194MX4Fn4Uu+B\n 8OoSNQA7kb0S25Ooo1wimHYXmgk9tpnErc276vSxF+15jbNxOtJV/zvyzCoXUR39ttn0eOVrNO2\n Aa/PVgHGzYvLpwVwkpGAI8a8SwVjE2M4R05BeDmlzHOCeWlwlIKKBlxdukV/1/daxVJTuoID4fW\n OCSTOVVjWafDPKQOKngYdHMxqPdjF3hlhObJQ1+fWi", "X-Gm-Gg": "AeBDiessx+PwDSfUGDHJ3gpvWDINYHEG5Lc9EuqpVIvs1Vj48eaGyx+yil9llvJlif8\n khk+uNI/SNm093H9j6580wdgKyPSxLcwOZcNov8IjJ1/DT7i1wMjbLvfEZ/GCJdbWIJpcO4TIMh\n EXqO//ajy42i02TVHuS1LLRQh2t0h0OyWtDbWPWYpcYwayfqK869U3P25fq+Kyjqwi0yb9LQaqn\n gsHuZpQStAf9brVBf01lire1Qox44l/w8WvZI2bFQ6vTjFiHRBMsEO5sAH/9QsJ1eRseGFdukn/\n Bp4gUSEPOzewHDcX+syC+Unhekg2QR/wR6gidOZA1x58ZhXvMmvaewIR6PYY11YMTMVYM5TNldV\n UJUoXf3xR8qMYIheDQ1qTJL0=", "X-Received": [ "by 2002:a05:690c:4b92:b0:7b1:c8e4:3271 with SMTP id\n 00721157ae682-7b9ed12bbc9mr226990867b3.3.1777039510536;\n Fri, 24 Apr 2026 07:05:10 -0700 (PDT)", "by 2002:a05:690c:4b92:b0:7b1:c8e4:3271 with SMTP id\n 00721157ae682-7b9ed12bbc9mr226990357b3.3.1777039509906;\n Fri, 24 Apr 2026 07:05:09 -0700 (PDT)" ], "From": "Patrick Palka <ppalka@redhat.com>", "To": "gcc-patches@gcc.gnu.org", "Cc": "jason@redhat.com,\n\tjakub@redhat.com,\n\tPatrick Palka <ppalka@redhat.com>", "Subject": "[PATCH] c++/modules+reflection: fix merging typedef struct { } A\n [PR124582]", "Date": "Fri, 24 Apr 2026 10:05:04 -0400", "Message-ID": "<20260424140504.1709726-1-ppalka@redhat.com>", "X-Mailer": "git-send-email 2.54.0.rc1.54.g60f07c4f5c", "MIME-Version": "1.0", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "ZhcjSMQHRQQrcytYUW8s9jgD9mU_2n7pQP-fOiiuIQo_1777039513", "X-Mimecast-Originator": "redhat.com", "Content-Transfer-Encoding": "8bit", "content-type": "text/plain; charset=\"US-ASCII\"; x-default=true", "X-BeenThere": "gcc-patches@gcc.gnu.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>", "List-Archive": "<https://gcc.gnu.org/pipermail/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-request@gcc.gnu.org?subject=help>", "List-Subscribe": "<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "Tested on x86_64-pc-linux-gnu (the new test and also the entire modules\ntestsuite w/ -std=c++26 -freflection) does this look OK for trunk, and\nperhaps 16.1, or should it wait for 16.2? The change is small and\nsimple and confined to -freflection, and fixes module std declaration\nmerging which is otherwise pretty much broken as the PR reports, and\nmight make many users sad. (Although 16 16 also has the #include\n<header> -> import std redirection which somewhat sidesteps the issue).\n\n-- >8 --\n\nr16-7903 changed the representation of typedefs to an unnamed type, such\nas typedef struct { } A, so that we preserve both the unnamed and typedef\nTYPE_DECL, rather than replacing the unnamed decl. This patch teaches\nmodules declaration merging to handle the new representation when streaming\nin the unnamed decl, working around the fact that the unnamed decl isn't\nvisible to name lookup but still has the same DECL_NAME as the typedef decl.\n\n\tPR c++/124582\n\tPR c++/123810\n\ngcc/cp/ChangeLog:\n\n\t* module.cc (check_mergeable_decl): Handle merging a typedef to\n\tan unnamed type with the -freflection representation.\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/modules/anon-4.h: New test.\n\t* g++.dg/modules/anon-4_a.H: New test.\n\t* g++.dg/modules/anon-4_b.C: New test.\n---\n gcc/cp/module.cc | 13 +++++++++++++\n gcc/testsuite/g++.dg/modules/anon-4.h | 2 ++\n gcc/testsuite/g++.dg/modules/anon-4_a.H | 6 ++++++\n gcc/testsuite/g++.dg/modules/anon-4_b.C | 6 ++++++\n 4 files changed, 27 insertions(+)\n create mode 100644 gcc/testsuite/g++.dg/modules/anon-4.h\n create mode 100644 gcc/testsuite/g++.dg/modules/anon-4_a.H\n create mode 100644 gcc/testsuite/g++.dg/modules/anon-4_b.C", "diff": "diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc\nindex 091031798dc8..98a285201d00 100644\n--- a/gcc/cp/module.cc\n+++ b/gcc/cp/module.cc\n@@ -12158,6 +12158,19 @@ check_mergeable_decl (merge_kind mk, tree decl, tree ovl, merge_key const &key)\n \t\t\t == key.ret))\n \t\tfound = match;\n \t }\n+\t /* With -freflection, typedef struct { } A is now represented the same\n+\t as typedef struct A_ { } A except the TYPE_DECL for A_ is invisible\n+\t to name lookup, so we won't be able to find and match it directly.\n+\t But we will find A, through which we can obtain A_. */\n+\t else if (flag_reflection\n+\t\t && TYPE_DECL_WAS_UNNAMED (d_inner)\n+\t\t && DECL_ORIGINAL_TYPE (m_inner))\n+\t {\n+\t tree orig = TYPE_NAME (DECL_ORIGINAL_TYPE (m_inner));\n+\t if (TYPE_DECL_WAS_UNNAMED (orig)\n+\t\t && DECL_NAME (orig) == DECL_NAME (d_inner))\n+\t\tfound = orig;\n+\t }\n \t break;\n \n \tdefault:\ndiff --git a/gcc/testsuite/g++.dg/modules/anon-4.h b/gcc/testsuite/g++.dg/modules/anon-4.h\nnew file mode 100644\nindex 000000000000..bb3692fc88cf\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/modules/anon-4.h\n@@ -0,0 +1,2 @@\n+typedef struct { } A;\n+struct B { typedef struct { } C; };\ndiff --git a/gcc/testsuite/g++.dg/modules/anon-4_a.H b/gcc/testsuite/g++.dg/modules/anon-4_a.H\nnew file mode 100644\nindex 000000000000..56a1851f3ffa\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/modules/anon-4_a.H\n@@ -0,0 +1,6 @@\n+// PR c++/124582\n+// { dg-do compile { target c++26 } }\n+// { dg-additional-options \"-fmodule-header -freflection\" }\n+// { dg-module-cmi {} }\n+\n+#include \"anon-4.h\"\ndiff --git a/gcc/testsuite/g++.dg/modules/anon-4_b.C b/gcc/testsuite/g++.dg/modules/anon-4_b.C\nnew file mode 100644\nindex 000000000000..c71a3088d6f6\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/modules/anon-4_b.C\n@@ -0,0 +1,6 @@\n+// PR c++/124582\n+// { dg-do compile { target c++26 } }\n+// { dg-additional-options \"-fmodules -fno-module-lazy -freflection\" }\n+\n+#include \"anon-4.h\"\n+import \"anon-4_a.H\";\n", "prefixes": [] }