On 10/13/26 3:32 AM, Jakub Jelinek wrote:
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;
A workaround like this really needs a comment.
OK with that addition.
Jason