Hi! The following testcase ICEs during SRA, where it decides to call type_contains_placeholder_p on the A type. type_contains_placeholder_1 handles all kinds of types, including NULLPTR_TYPE, but obviously doesn't handle LANG_TYPE, it doesn't know what LANG_TYPE is and whether it contains placeholders or not. We could handle LANG_TYPE with just specific flag or specific name (I think the former is what we are converging to for LTO) in that function, but we already have a mechanism to cache that value in the types, so even without that magic flag on LANG_TYPE we can just say that the type never contains a placeholder when we create the type.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2026-10-13 Jakub Jelinek <[email protected]> PR c++/127856 * reflect.cc (init_reflection): Set TYPE_CONTAINS_PLACEHOLDER_INTERNAL on meta_info_type_node to 1. * g++.dg/reflect/pr127856.C: New test. --- a/gcc/cp/reflect.cc 2026-09-30 08:56:53.834224955 +0200 +++ b/gcc/cp/reflect.cc 2026-10-12 16:41:07.965736245 +0200 @@ -69,6 +69,7 @@ init_reflection () TYPE_PRECISION (meta_info_type_node) = GET_MODE_BITSIZE (ptr_mode); SET_TYPE_MODE (meta_info_type_node, ptr_mode); SET_TYPE_ALIGN (meta_info_type_node, GET_MODE_ALIGNMENT (ptr_mode)); + TYPE_CONTAINS_PLACEHOLDER_INTERNAL (meta_info_type_node) = 1; /* Name it. */ record_builtin_type (RID_MAX, "decltype(^^int)", meta_info_type_node); --- a/gcc/testsuite/g++.dg/reflect/pr127856.C 2026-10-12 16:30:54.863988479 +0200 +++ b/gcc/testsuite/g++.dg/reflect/pr127856.C 2026-10-12 16:32:47.764456906 +0200 @@ -0,0 +1,11 @@ +// PR c++/127856 +// { dg-do compile { target c++26 } } +// { dg-additional-options "-O2 -freflection" } + +struct A { decltype (^^int) a; bool b = true; }; + +void +foo () +{ + A a; +} Jakub
