https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125111
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I was thinking of
--- gcc/cp/reflect.cc.jj 2026-05-01 21:47:53.656712280 +0200
+++ gcc/cp/reflect.cc 2026-05-04 16:24:08.170041771 +0200
@@ -7453,6 +7453,11 @@ extract_ref (location_t loc, const const
{
if (TYPE_REF_P (type))
type = TREE_TYPE (type);
+ if (TREE_CODE (type) == FUNCTION_TYPE
+ || TREE_CODE (type) == METHOD_TYPE
+ || (TREE_CODE (type) == ARRAY_TYPE
+ && TYPE_DOMAIN (type) == NULL_TREE))
+ return error_mark_node;
type = build_cplus_array_type (type, NULL_TREE);
return build_pointer_type (type);
};
@@ -7462,7 +7467,11 @@ extract_ref (location_t loc, const const
{
/* The wording is saying that U is the type of r. */
tree U = TREE_TYPE (r);
- if (is_convertible (adjust_type (U), adjust_type (T))
+ tree adju = adjust_type (U);
+ tree adjt = adjust_type (T);
+ if (adju != error_mark_node
+ && adjt != error_mark_node
+ && is_convertible (adju, adjt)
&& (!var_p || is_constant_expression (r)))
{
if (TYPE_REF_P (TREE_TYPE (r)))
plus testsuite coverage.