Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2225931/?format=api
{ "id": 2225931, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2225931/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260421202158.882350-1-polacek@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": "<20260421202158.882350-1-polacek@redhat.com>", "date": "2026-04-21T20:21:58", "name": "c++/reflection: odr-used inline var of consteval-only type [PR124770]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "8ba5a3ccf8fd44c1ef5ea7bde970192865dcad68", "submitter": { "id": 14370, "url": "http://patchwork.ozlabs.org/api/1.1/people/14370/?format=api", "name": "Marek Polacek", "email": "polacek@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260421202158.882350-1-polacek@redhat.com/mbox/", "series": [ { "id": 500890, "url": "http://patchwork.ozlabs.org/api/1.1/series/500890/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=500890", "date": "2026-04-21T20:21:58", "name": "c++/reflection: odr-used inline var of consteval-only type [PR124770]", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/500890/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2225931/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2225931/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=WmVFEMyp;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::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=WmVFEMyp", "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.129.124" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::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 4g0Ygb0Tzrz1yJG\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 06:22:33 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id D91BA4BA540B\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 20:22:31 +0000 (GMT)", "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by sourceware.org (Postfix) with ESMTP id E09254BA540B\n for <gcc-patches@gcc.gnu.org>; Tue, 21 Apr 2026 20:22:04 +0000 (GMT)", "from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-257-DRXvDomKOxCUm1D1waztXw-1; Tue,\n 21 Apr 2026 16:22:02 -0400", "from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id E6B48195605F\n for <gcc-patches@gcc.gnu.org>; Tue, 21 Apr 2026 20:22:01 +0000 (UTC)", "from pdp-11.redhat.com (unknown [10.22.65.59])\n by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 67B053000C21; Tue, 21 Apr 2026 20:22:01 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org D91BA4BA540B", "OpenDKIM Filter v2.11.0 sourceware.org E09254BA540B" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org E09254BA540B", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org E09254BA540B", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776802925; cv=none;\n b=iySIgF5KuivKZP6bj/P3NBjqDIs1OKjHsiVp/IhZDgExMKQfRpFPyqT4sU/WJ3cgO2nsSEpIG4y+L5UmXzKnc/lZV0Zlxsq1OXHio/RDK5heYcNOqkpy+HtN3BX3A0ElJFDmRgYV3Khfu4uJW6S5wSuGyTHkLZDau1mcgC0B7/c=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776802925; c=relaxed/simple;\n bh=jIqjc5rAdL/lqogQyurCUgO/NJx5mNBWJhxA9/E9XPg=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=iHO8vE5xMH04t2w7gWubw6cR1jlLhwCYazw3u6fOLuGvHtUZJuiT35ClzAiMPLG4z0BHG3o71cW9t8WVu8/K4zyfHXLUpp8ksGzCocZ6kkqryJE2mvqeLaWfBNm8pzpIFpCi9YMkDblj1NMnIbK+3VdJl2yc5HTo9pFI18uXakQ=", "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=1776802924;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=EAuJVyJ/FS2gNaC9h/9vJhHYJ8RiA69kv46bDlWboTQ=;\n b=WmVFEMypp1HdMwJnTofPgewpfITQZ2++SWjAMiJYDo3e0FLsCBDmJcVzouzEZEVp/ld2Xw\n wP1BVdSJbWGkZ21OfmTWnXxbiJXTpxTP6Xu9K56jNj+kaCTUWz9phO4RSPWDFvF0+289j3\n AsyfsIPchfx5mKlYhmnFZ2+7TMKgf3Y=", "X-MC-Unique": "DRXvDomKOxCUm1D1waztXw-1", "X-Mimecast-MFC-AGG-ID": "DRXvDomKOxCUm1D1waztXw_1776802922", "From": "Marek Polacek <polacek@redhat.com>", "To": "GCC Patches <gcc-patches@gcc.gnu.org>,\n\tJason Merrill <jason@redhat.com>", "Subject": "[PATCH] c++/reflection: odr-used inline var of consteval-only type\n [PR124770]", "Date": "Tue, 21 Apr 2026 16:21:58 -0400", "Message-ID": "<20260421202158.882350-1-polacek@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.4", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "vljXcMnRLnyqF_8KS2I8r8TkJr_7W2dgoQ8QwAAfPjw_1776802922", "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": "Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?\n\n-- >8 --\nwrapup_namespace_globals gives errors for code like\n\n extern inline int i;\n int &r = i; // odr-used inline variable is not defined\n\nbut because we mark consteval-only vars DECL_EXTERNAL, we also wrongly\nemit the error for:\n\n inline constexpr info value{};\n static_assert(value == info{});\n\nwhere value clearly is defined. ISTM that we should check !consteval_only_p\nbefore giving this error because the test where this could trigger:\n\n extern constexpr inline info x;\n\nis already ill-formed (\"declaration of 'constexpr' variable 'x' is not\na definition\").\n\n\tPR c++/124770\n\ngcc/cp/ChangeLog:\n\n\t* decl.cc (wrapup_namespace_globals): Don't give the odr-used\n\tinline variable error for consteval-only variables.\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/reflect/init18.C: New test.\n---\n gcc/cp/decl.cc | 6 +++++-\n gcc/testsuite/g++.dg/reflect/init18.C | 14 ++++++++++++++\n 2 files changed, 19 insertions(+), 1 deletion(-)\n create mode 100644 gcc/testsuite/g++.dg/reflect/init18.C\n\n\nbase-commit: 80958ebae3ca639c861492c2b6f2d34c9cd5ece8", "diff": "diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc\nindex 679a8007ca6..7837e322d17 100644\n--- a/gcc/cp/decl.cc\n+++ b/gcc/cp/decl.cc\n@@ -1024,7 +1024,11 @@ wrapup_namespace_globals ()\n \t if (VAR_P (decl)\n \t && DECL_EXTERNAL (decl)\n \t && DECL_INLINE_VAR_P (decl)\n-\t && DECL_ODR_USED (decl))\n+\t && DECL_ODR_USED (decl)\n+\t /* We mark consteval-only vars extern, but they also have to be\n+\t\t declared constexpr and \"extern constexpr inline info x;\" is\n+\t\t ill-formed. */\n+\t && !consteval_only_p (decl))\n \t error_at (DECL_SOURCE_LOCATION (decl),\n \t\t \"odr-used inline variable %qD is not defined\", decl);\n \t}\ndiff --git a/gcc/testsuite/g++.dg/reflect/init18.C b/gcc/testsuite/g++.dg/reflect/init18.C\nnew file mode 100644\nindex 00000000000..f13125be66e\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/init18.C\n@@ -0,0 +1,14 @@\n+// PR c++/124770\n+// { dg-do compile { target c++26 } }\n+// { dg-additional-options \"-freflection\" }\n+\n+using info = decltype(^^::);\n+\n+constexpr inline info v{};\n+static_assert(v == info{});\n+extern constexpr inline info v2{};\n+static_assert(v2 == info{});\n+constexpr inline info v3;\n+static_assert(v3 == info{});\n+\n+extern constexpr inline info v4; // { dg-error \"not a definition|consteval-only\" }\n", "prefixes": [] }