Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2217889/?format=api
{ "id": 2217889, "url": "http://patchwork.ozlabs.org/api/patches/2217889/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260330211206.766668-1-polacek@redhat.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/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, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260330211206.766668-1-polacek@redhat.com>", "list_archive_url": null, "date": "2026-03-30T21:12:06", "name": "c++/reflection: spurious error with constrained return types [PR124457]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "d2ebf85aff391293e1213c0a3c702f659b783896", "submitter": { "id": 14370, "url": "http://patchwork.ozlabs.org/api/people/14370/?format=api", "name": "Marek Polacek", "email": "polacek@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260330211206.766668-1-polacek@redhat.com/mbox/", "series": [ { "id": 498096, "url": "http://patchwork.ozlabs.org/api/series/498096/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=498096", "date": "2026-03-30T21:12:06", "name": "c++/reflection: spurious error with constrained return types [PR124457]", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/498096/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2217889/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2217889/checks/", "tags": {}, "related": [], "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=iJERqoa7;\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=iJERqoa7", "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 4fl3qf0Ktgz1yCp\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 08:12:45 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id B64524BB58EF\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 30 Mar 2026 21:12:43 +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 6177C4BA900E\n for <gcc-patches@gcc.gnu.org>; Mon, 30 Mar 2026 21:12:15 +0000 (GMT)", "from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-97-c3PY03AiPpurwT1idE4h9Q-1; Mon,\n 30 Mar 2026 17:12:12 -0400", "from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])\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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id DE5BC1800344\n for <gcc-patches@gcc.gnu.org>; Mon, 30 Mar 2026 21:12:11 +0000 (UTC)", "from pdp-11.lan (unknown [10.22.80.201])\n by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 6A4571954102; Mon, 30 Mar 2026 21:12:11 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org B64524BB58EF", "OpenDKIM Filter v2.11.0 sourceware.org 6177C4BA900E" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 6177C4BA900E", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 6177C4BA900E", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774905135; cv=none;\n b=K31lRdRj3frRtAal2i+uHRynyTFDBzY0UU3WTByzrV5A56psQ92oT71uu83epUS7lCFokRs7sgKByDwoh0vcqS8HqKVvPZ7Ee18V9EUeXFWGVj4RXXQr2VCwJ0sHrmB3VZVdhYRwk3HJ7bHPeyAsL7R7i3GRvfxQxKgtDgJR4qQ=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1774905135; c=relaxed/simple;\n bh=xSGOUlf7HQfa11VR+KnYg6WgE6KxdNcfx0ujKYlmAk0=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=xeluX6eTN7RwmreXtWjOcUctN6FsaWMb9IvhoxiQucZ1Ide8QkOwHtDToCRDfA8zwe3cpnc55+lJHIkXVwCq+2taEtFlq8Cw2W0VFuJfvRn68z7qOzRMaYxl+aahEnatxORfDuXMvYiRFskjhK+brioVO4BU7z8fmpBj34eKMxo=", "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=1774905135;\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=tTgQrlz3/1uNySvWEYFhvDkknR8nZtJqNzSygQ52Odk=;\n b=iJERqoa7ArGL+1bYqTvI33LSSAcUCO5AQ1DO0/4LvAj+eaaoL/j5OKGkSoj/c9RrX60DHT\n x7iQWi3za2FSaGuyf80IRbWe/jUrusByYy8HQ19JOr+FeJtM3EzJ6E3AweCRmeXiFEw8oy\n /LINwSSuG6QJK+UNClF9QZj7DbV0S1U=", "X-MC-Unique": "c3PY03AiPpurwT1idE4h9Q-1", "X-Mimecast-MFC-AGG-ID": "c3PY03AiPpurwT1idE4h9Q_1774905132", "From": "Marek Polacek <polacek@redhat.com>", "To": "GCC Patches <gcc-patches@gcc.gnu.org>,\n\tJason Merrill <jason@redhat.com>", "Subject": "[PATCH] c++/reflection: spurious error with constrained return types\n [PR124457]", "Date": "Mon, 30 Mar 2026 17:12:06 -0400", "Message-ID": "<20260330211206.766668-1-polacek@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.17", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "j852dHaruxpd3dSCJJayVRJ25UykOHfAI1F2ezuG_y8_1774905132", "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 --\nHere we are emitting a bogus error in get_reflection because it\ngot something for which is_auto was true: the constrained auto\ncoming from make_constrained_auto. We represent the\nreturn-type-requirement as a constrained auto which is in fact\na placeholder, but in this case we don't want the error. In the PR\nJason suggested doing something to obscure the placeholderness\nacross the call to build_concept_check. I think we could rewrite\nthe identifier for the build_concept_check call.\n\n\tPR c++/124457\n\ngcc/cp/ChangeLog:\n\n\t* cp-tree.h (make_generic_type_name): Declare.\n\t* parser.cc (make_generic_type_name): No longer static.\n\t* pt.cc (make_constrained_placeholder_type): Use\n\tmake_generic_type_name to temporarily obfuscate the name.\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/reflect/concept1.C: New test.\n---\n gcc/cp/cp-tree.h | 1 +\n gcc/cp/parser.cc | 2 +-\n gcc/cp/pt.cc | 5 +++++\n gcc/testsuite/g++.dg/reflect/concept1.C | 14 ++++++++++++++\n 4 files changed, 21 insertions(+), 1 deletion(-)\n create mode 100644 gcc/testsuite/g++.dg/reflect/concept1.C\n\n\nbase-commit: 2c1a819254cc892877014169f99edce7eaced66f", "diff": "diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h\nindex ea3cb049785..333dc56551a 100644\n--- a/gcc/cp/cp-tree.h\n+++ b/gcc/cp/cp-tree.h\n@@ -8046,6 +8046,7 @@ extern bool literal_integer_zerop (const_tree);\n extern tree attr_chainon (tree, tree);\n extern tree maybe_add_dummy_lambda_op (tree);\n extern void remove_dummy_lambda_op (tree, tree);\n+extern tree make_generic_type_name ();\n \n /* in pt.cc */\n extern tree canonical_type_parameter\t\t(tree);\ndiff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc\nindex 8d88dc9c312..f7e254e8f7c 100644\n--- a/gcc/cp/parser.cc\n+++ b/gcc/cp/parser.cc\n@@ -57485,7 +57485,7 @@ c_parse_file (void)\n template parameter implied by `auto' or a concept identifier). */\n \n static GTY(()) int generic_parm_count;\n-static tree\n+tree\n make_generic_type_name ()\n {\n char buf[32];\ndiff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc\nindex 020a70c1112..b4ba7d150e0 100644\n--- a/gcc/cp/pt.cc\n+++ b/gcc/cp/pt.cc\n@@ -30941,7 +30941,12 @@ make_constrained_placeholder_type (tree type, tree con, tree args)\n /* Build the constraint. */\n tree tmpl = DECL_TI_TEMPLATE (con);\n ++processing_template_decl;\n+ tree old_name = TYPE_IDENTIFIER (type);\n+ /* Temporarily obfuscate the name so that we don't emit the \"placeholder\n+ type\" error when taking the reflection of this constrained auto. */\n+ TYPE_IDENTIFIER (type) = make_generic_type_name ();\n tree expr = build_concept_check (tmpl, type, args, tf_warning_or_error);\n+ TYPE_IDENTIFIER (type) = old_name;\n --processing_template_decl;\n \n PLACEHOLDER_TYPE_CONSTRAINTS_INFO (type)\ndiff --git a/gcc/testsuite/g++.dg/reflect/concept1.C b/gcc/testsuite/g++.dg/reflect/concept1.C\nnew file mode 100644\nindex 00000000000..88121f20d01\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/concept1.C\n@@ -0,0 +1,14 @@\n+// PR c++/124457\n+// { dg-do compile { target c++26 }\n+// { dg-additional-options \"-freflection\" }\n+\n+template <class T, auto t = ^^T>\n+concept True = true;\n+\n+template <class T>\n+concept AlsoTrue = requires (T t) {\n+ { t } -> True;\n+};\n+void f1(True auto x);\n+template <True T> void f2(T );\n+auto f3(int) -> True auto;\n", "prefixes": [] }