{"id":2224037,"url":"http://patchwork.ozlabs.org/api/patches/2224037/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/aeECjy5O6sXf2YA5@redhat.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/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,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<aeECjy5O6sXf2YA5@redhat.com>","list_archive_url":null,"date":"2026-04-16T15:38:55","name":"c++/reflection: splicing null reflection","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"262c04fa1d60281820ccb3887e9c9a54425dcff4","submitter":{"id":14370,"url":"http://patchwork.ozlabs.org/api/people/14370/?format=json","name":"Marek Polacek","email":"polacek@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/aeECjy5O6sXf2YA5@redhat.com/mbox/","series":[{"id":500180,"url":"http://patchwork.ozlabs.org/api/series/500180/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=500180","date":"2026-04-16T15:38:55","name":"c++/reflection: splicing null reflection","version":1,"mbox":"http://patchwork.ozlabs.org/series/500180/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2224037/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2224037/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=hIBYxAgi;\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=hIBYxAgi","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\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 4fxMdJ5RNRz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 01:39:31 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 9770B4BA9035\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 15:39:29 +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 9A5C34BA23F5\n for <gcc-patches@gcc.gnu.org>; Thu, 16 Apr 2026 15:39:01 +0000 (GMT)","from mail-qv1-f69.google.com (mail-qv1-f69.google.com\n [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-652-Rfm-3WE0Pr6KsG6Cvo0Gcw-1; Thu, 16 Apr 2026 11:39:00 -0400","by mail-qv1-f69.google.com with SMTP id\n 6a1803df08f44-8a1accb970fso220579356d6.3\n for <gcc-patches@gcc.gnu.org>; Thu, 16 Apr 2026 08:39:00 -0700 (PDT)","from redhat.com ([2603:7000:9500:10::1db4])\n by smtp.gmail.com with ESMTPSA id\n 6a1803df08f44-8ae6c9380dfsm38745896d6.6.2026.04.16.08.38.56\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 16 Apr 2026 08:38:57 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 9770B4BA9035","OpenDKIM Filter v2.11.0 sourceware.org 9A5C34BA23F5"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 9A5C34BA23F5","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 9A5C34BA23F5","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776353941; cv=none;\n b=wJqnAqYPUro6CLoinMiWnSaLmJW1+aZB+mkWjV6KboJf1ufe6UBhErEmQsHFPF3UqgAxdo6IAYbpN495j+mDx0Ywe08zavzhVtq5kklvR7RFX6ZQ2hk9DpH2/BMSLC/07YP7dLb8R1DH9IzAFzeFOmDQuSsyS6awF136xHmhSmE=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776353941; c=relaxed/simple;\n bh=3wCmL8Cop5nAyy1p14MrGbJF/z3DaYyxEmnF9k0sn6k=;\n h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;\n b=f+Hha5OwPYzP6oYvO49PcU5wNMjRejt16gzu0eA7VuQUHStGea4UM8PgK6zsgXPshU27NdvsG7XiituUyORGc43vpT6i5ylAe3SnFe7Fw5azW/BYOoqeR3GbTP0NscyiF30Nx8vmLHxU7VTd8wl7n10kJK4UA+MVMyOhUtZwKeU=","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=1776353941;\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 in-reply-to:in-reply-to:references:references;\n bh=yU8MP3iqIb2duyfqtZJQs0BXZwhWt7ughHMw6exen/k=;\n b=hIBYxAgi7nUBMCmDgDq8Z6aSUlewce9EvvS9i3rJjx6wOlZ12pw2lrY8bAX7Id2ClA58km\n VAGGvzeDbIB0yc9yRUVITiXUvJbeoFPVImgkaPN+9Xhs0syWJBqGchChZoN3ulZNLL7aMt\n oJALp6vBe/715mv9bAC6xqVJkdvQA2U=","X-MC-Unique":"Rfm-3WE0Pr6KsG6Cvo0Gcw-1","X-Mimecast-MFC-AGG-ID":"Rfm-3WE0Pr6KsG6Cvo0Gcw_1776353939","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776353938; x=1776958738;\n h=user-agent:in-reply-to:content-disposition:mime-version:references\n :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=yU8MP3iqIb2duyfqtZJQs0BXZwhWt7ughHMw6exen/k=;\n b=PxQR+HkFycdLkiopxwUnf1Sg2bErTtPdXLhp8KL8+gYLHzYizy2h9U196RwUzmcwmU\n JFYEh+5gFqrFYy/CuUiSXk0SlcTEmPYsIYfUfVkf1Y90JM/i0SXSVuNhNb1/vCjxbmCy\n wBGaWN9yKcWMpJbmllFNeIWDy9FenqmUQ32c4svPtYYSBSRyQBNq6kkOJHyfkH3+wtqw\n agWDoZHDP3NRiqr9FD7/ulK5vgFhKV4kIqQ1fJ7dFqa4TSpGEBYkkW9ntjvPb6NXNwsp\n mnQ+SE15PE6fkBvfiSzikAvj/RJThZr4pykmoV0prhc6H8oalVHuF3PRI/+qS2rtyv+f\n 9acQ==","X-Gm-Message-State":"AOJu0YwCLkpOefYkf2yIOBqD1hUvVoOxL53FerB8RROZC9fhJbPxt8GH\n u1VDMjWs7A31+HMrt8/CPCsrudpxjOAoPOJ4BhwQfkB1du//bjsUccyPlCkIVaJvn+b6s06ipFj\n Ajpwak7kG4NfhBC6FMSm34l/pVBpuLivqbYRLKfVtjpDN/W50cWF0gEtDkbnMphbmdws=","X-Gm-Gg":"AeBDiev79K7fXyKvieAShCDAQQ+Er1XT1fgvGJACCsoQ/GvS0GVXIrX6V2EY8qa7PFp\n hM0N/ZGuKJ+43Z6AuP51VK8LPzMnfLlVV8Xbw0zl1dSpgoDLEg7bA3N7o2CVnBDZbbFYT04tHUa\n QF7CgaOhFwKwRkKesIblv1JtGF7ol2zmoROfgQEIeR0pLGGQEqQJlX/78R5RNo5lzqsD3k49g/e\n EArtqAiM/83OKagVJZ/SirD9svcHHgNQP/Q3+1W6QfGrV9NCDwcBFoXUahxMqUp8MImtfFv/iXt\n jIKP3T2YZJ3CNp3gCpJiIG1N31XLnlrrugDXe+zrgXHCzOlk5a2DmEWQF8jUPk5A1xkakuRTDtb\n haw==","X-Received":["by 2002:a05:6214:3217:b0:8ae:6347:8c91 with SMTP id\n 6a1803df08f44-8ae63478f54mr167013146d6.3.1776353938389;\n Thu, 16 Apr 2026 08:38:58 -0700 (PDT)","by 2002:a05:6214:3217:b0:8ae:6347:8c91 with SMTP id\n 6a1803df08f44-8ae63478f54mr167012786d6.3.1776353937788;\n Thu, 16 Apr 2026 08:38:57 -0700 (PDT)"],"Date":"Thu, 16 Apr 2026 11:38:55 -0400","From":"Marek Polacek <polacek@redhat.com>","To":"Jason Merrill <jason@redhat.com>","Cc":"GCC Patches <gcc-patches@gcc.gnu.org>","Subject":"[PATCH] c++/reflection: splicing null reflection","Message-ID":"<aeECjy5O6sXf2YA5@redhat.com>","References":"<20260415235200.1576761-1-polacek@redhat.com>\n <05317d8e-be32-4c67-8d50-becc3864e65e@redhat.com>","MIME-Version":"1.0","In-Reply-To":"<05317d8e-be32-4c67-8d50-becc3864e65e@redhat.com>","User-Agent":"Mutt/2.3.1 (2026-03-20)","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"-uK9oj3XvwDFwgvw9ZlPuI5KNWvHeqKPUlu1SE6B1vk_1776353939","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","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":"On Thu, Apr 16, 2026 at 09:40:47AM -0400, Jason Merrill wrote:\n> On 4/15/26 7:52 PM, Marek Polacek wrote:\n> > Tested reflect/* on x86_64-pc-linux-gnu, ok for trunk?\n> > \n> > -- >8 --\n> > Here we are printing:\n> > \n> >    note: but ''lang_type' not supported by dump_expr<expression error>' is a type\n> > \n> > because we represent a null reflection with unknown_type_node.  Let's\n> > not print anything in that case; unknown_type_node can also be\n> > <unresolved overloaded function type>.\n> \n> Can we diagnose sooner trying to splice a null reflection?  That should be\n> ill-formed regardless of whether we expect it to be a type or expression or\n> whatever.\n\nSounds good, thanks.\n\nTested 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\ndetect splicing a null reflection.\n\ngcc/cp/ChangeLog:\n\n\t* reflect.cc (check_splice_expr): Detect a null reflection.\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/reflect/null6.C: New test.\n---\n gcc/cp/reflect.cc                    | 7 +++++++\n gcc/testsuite/g++.dg/reflect/null6.C | 6 ++++++\n 2 files changed, 13 insertions(+)\n create mode 100644 gcc/testsuite/g++.dg/reflect/null6.C\n\n\nbase-commit: 257daea0bf0ff41ca3278bc27db65a6aa475cc62","diff":"diff --git a/gcc/cp/reflect.cc b/gcc/cp/reflect.cc\nindex 2b7e7033953..ea7616a62bc 100644\n--- a/gcc/cp/reflect.cc\n+++ b/gcc/cp/reflect.cc\n@@ -8929,6 +8929,13 @@ check_splice_expr (location_t loc, location_t start_loc, tree t,\n \t\t   bool address_p, bool member_access_p, bool template_p,\n \t\t   bool targs_p, bool complain_p)\n {\n+  if (t == unknown_type_node)\n+    {\n+      if (complain_p)\n+\terror_at (loc, \"cannot splice a null reflection\");\n+      return false;\n+    }\n+\n   /* We may not have gotten an expression.  */\n   if (TREE_CODE (t) == TYPE_DECL\n       || TREE_CODE (t) == NAMESPACE_DECL\ndiff --git a/gcc/testsuite/g++.dg/reflect/null6.C b/gcc/testsuite/g++.dg/reflect/null6.C\nnew file mode 100644\nindex 00000000000..bfa2b6ba241\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/null6.C\n@@ -0,0 +1,6 @@\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 \"cannot splice a null reflection\" }\n","prefixes":[]}