On 2/6/26 10:04 PM, Marek Polacek wrote:
On Fri, Feb 06, 2026 at 10:50:06AM +0100, Jakub Jelinek wrote:
Hi!
SPLICE_SCOPE is a TYPE_P, but didn't have its SPLICE_SCOPE_EXPR
walked by cp_walk_tree, so the following testcase has been rejected
because it didn't find a pack in it.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk?
This looks ok, thanks.
Yes, OK.
SPLICE_EXPR is fine, as it is tcc_expression and walk_tree by default
walks all the tcc_exception operands for unknown trees.
2026-02-05 Jakub Jelinek <[email protected]>
PR c++/123659
* tree.cc (cp_walk_subtrees): Handle SPLICE_SCOPE.
* g++.dg/reflect/splice9.C: New test.
--- gcc/cp/tree.cc.jj 2026-02-05 15:14:55.737587562 +0100
+++ gcc/cp/tree.cc 2026-02-05 20:15:26.520969841 +0100
@@ -6273,6 +6273,11 @@ cp_walk_subtrees (tree *tp, int *walk_su
WALK_SUBTREE (TYPE_MAX_VALUE (t));
break;
+ case SPLICE_SCOPE:
+ WALK_SUBTREE (SPLICE_SCOPE_EXPR (t));
+ *walk_subtrees_p = 0;
+ break;
+
default:
return NULL_TREE;
}
--- gcc/testsuite/g++.dg/reflect/splice9.C.jj 2026-02-05 20:23:10.619125676
+0100
+++ gcc/testsuite/g++.dg/reflect/splice9.C 2026-02-05 20:23:31.363775053
+0100
@@ -0,0 +1,21 @@
+// PR c++/123659
+// { dg-do compile { target c++26 } }
+// { dg-additional-options "-freflection" }
+
+#include <meta>
+
+struct S {};
+
+template <int...I>
+void
+foo ()
+{
+ static constexpr std::meta::info t[] { ^^int, ^^long, ^^S, ^^double };
+ [] (typename [: t[I] :]... a) {} (1, S {}, 2.5, 3L, 4L);
+}
+
+void
+bar ()
+{
+ foo <0, 2, 3, 1, 1> ();
+}
Jakub
Marek