{"id":2223672,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2223672/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20260415235200.1576761-1-polacek@redhat.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.1/projects/17/?format=json","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":"<20260415235200.1576761-1-polacek@redhat.com>","date":"2026-04-15T23:52:00","name":"c++/reflection: null reflection in inform_tree_category","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"b58f7461971f7496c46ac19ca4b1d441d5d1c795","submitter":{"id":14370,"url":"http://patchwork.ozlabs.org/api/1.1/people/14370/?format=json","name":"Marek Polacek","email":"polacek@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20260415235200.1576761-1-polacek@redhat.com/mbox/","series":[{"id":500055,"url":"http://patchwork.ozlabs.org/api/1.1/series/500055/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=500055","date":"2026-04-15T23:52:00","name":"c++/reflection: null reflection in inform_tree_category","version":1,"mbox":"http://patchwork.ozlabs.org/series/500055/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2223672/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2223672/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=gKhhlUjD;\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=gKhhlUjD","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 4fwycl75Kgz1yHP\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 09:52:38 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 4DD104BA2E14\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 23:52:35 +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 2D3274BA2E10\n for <gcc-patches@gcc.gnu.org>; Wed, 15 Apr 2026 23:52:09 +0000 (GMT)","from mx-prod-mc-05.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-65-vvNOn--nOS65Ru81IcjRdQ-1; Wed,\n 15 Apr 2026 19:52:06 -0400","from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])\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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 1BEC6195608D\n for <gcc-patches@gcc.gnu.org>; Wed, 15 Apr 2026 23:52:06 +0000 (UTC)","from pdp-11.redhat.com (unknown [10.22.81.27])\n by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 8127C180047F; Wed, 15 Apr 2026 23:52:05 +0000 (UTC)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 4DD104BA2E14","OpenDKIM Filter v2.11.0 sourceware.org 2D3274BA2E10"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 2D3274BA2E10","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 2D3274BA2E10","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776297129; cv=none;\n b=w9yrz99pGCo+JaLj1Jywey8RTuCtne3i1GqPiwB5jsXC/aQlAbtwdoXy8I6pZfveCSz4I3tD1SsfE5oVhARIbmICBlpMVZ+b+vLvKfoNHbMiAE+mUV938JQ1lWno1J0U+U0KZmOxyHXY5Nzkc2esXie+HjkLBkAcZgDKlqlidwk=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776297129; c=relaxed/simple;\n bh=3UUgG/5sQjrosJUFfQb4+LZikC/Wqk1anNnisd+tg+I=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=PMJPum46KVlHZs/5p9NocQseWUmSF3Ah+WJzTQWlJ6YULei+FihSEYa8VGfZQT/4pDhqBC0CJmGmGNxAHoZ1xApdWYIHNkOpEAyTfnCnND4UgnKG+Gj68nJqwCf2XXk58Xj/kSVh2XJIUJsdaf9cJ3S9dU8eUjJQkPr3h4UaIPA=","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=1776297128;\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=bjXr+AzgR1BLa4WC4xw5MrMURB5ZJmLM8GmDm00eKAo=;\n b=gKhhlUjD97Qhe2EsSwn/1P2UV76ccs4ReqSuWOulaebXbmAt6PUTD81/8UudSl2CjWgVbL\n Q5ooes91mRviqTvXJUqNY7q3A5XKefkUZDU3nBhJUBN2MEDCjYi9iCvfQlgfVvUKgMSkhQ\n 3XmJneAsHZCLA9oL7div01akQUAVYAg=","X-MC-Unique":"vvNOn--nOS65Ru81IcjRdQ-1","X-Mimecast-MFC-AGG-ID":"vvNOn--nOS65Ru81IcjRdQ_1776297126","From":"Marek Polacek <polacek@redhat.com>","To":"Jason Merrill <jason@redhat.com>,\n\tGCC Patches <gcc-patches@gcc.gnu.org>","Subject":"[PATCH] c++/reflection: null reflection in inform_tree_category","Date":"Wed, 15 Apr 2026 19:52:00 -0400","Message-ID":"<20260415235200.1576761-1-polacek@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.4.1 on 10.30.177.93","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"kLwhUnwvhcTNFu9b0iq6Lv2h8xT3atAqUMzflPBkUf4_1776297126","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 reflect/* on x86_64-pc-linux-gnu, ok for trunk?\n\n-- >8 --\nHere we are printing:\n\n  note: but ''lang_type' not supported by dump_expr<expression error>' is a type\n\nbecause we represent a null reflection with unknown_type_node.  Let's\nnot print anything in that case; unknown_type_node can also be\n<unresolved overloaded function type>.\n\ngcc/cp/ChangeLog:\n\n\t* error.cc (inform_tree_category): Don't print unknown_type_node.\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/reflect/null6.C: New test.\n---\n gcc/cp/error.cc                      | 2 +-\n gcc/testsuite/g++.dg/reflect/null6.C | 8 ++++++++\n 2 files changed, 9 insertions(+), 1 deletion(-)\n create mode 100644 gcc/testsuite/g++.dg/reflect/null6.C\n\n\nbase-commit: 77d4080e1e5f9d467816e2e2e878edbfbb7ee1c1","diff":"diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc\nindex b3e66924e31..f0097bf6808 100644\n--- a/gcc/cp/error.cc\n+++ b/gcc/cp/error.cc\n@@ -3988,7 +3988,7 @@ inform_tree_category (tree t)\n   if (TREE_CODE (t) == TYPE_DECL)\n     t = TREE_TYPE (t);\n \n-  if (TYPE_P (t))\n+  if (TYPE_P (t) && t != unknown_type_node)\n     inform (loc, \"but %qE is a type\", t);\n   else if (EXPR_P (t))\n     inform (loc, \"but %qE is an expression\", t);\ndiff --git a/gcc/testsuite/g++.dg/reflect/null6.C b/gcc/testsuite/g++.dg/reflect/null6.C\nnew file mode 100644\nindex 00000000000..55bf15ef959\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/null6.C\n@@ -0,0 +1,8 @@\n+// { dg-do compile { target c++26 } }\n+// { dg-additional-options \"-freflection\" }\n+\n+using info = decltype(^^::);\n+constexpr auto null = info{};\n+constexpr auto q = [:null:];  // { dg-error \"expected a reflection of an expression\" }\n+// { dg-message \"add .typename.\" \"\" { target *-*-* } .-1 }\n+// { dg-bogus \"is a type\" \"\" { target *-*-* } .-2 }\n","prefixes":[]}