On Wed, Jan 07, 2026 at 04:11:10PM +0800, Jason Merrill wrote:
> > +  if (eval_is_type (r) == boolean_true_node
> > +      && eval_is_function_type (r) == boolean_true_node)
> 
> I was thinking that calling eval_is_type seems redundant, but then saw that
> all the is_*_type metafunctions are supposed to throw if the argument isn't
> a type (but currently don't?).

They weren't originally redundant, eval_is_function_type etc. were throwing
if not eval_is_type.
I've changed that in
https://forge.sourceware.org/marek/gcc/commit/34293549c7c3
when metafns.gperf has been introduced, those functions are now marked
METAFN_KIND_BOOL_TINFO or similar kinds and then process_metafunction does
      if (((minfo->kind >> 5) & 31) == METAFN_KIND_ARG_TINFO)
        {
          if (eval_is_type (h) != boolean_true_node)
            return throw_exception_nontype (loc, ctx, fun, non_constant_p,
                                            jump_target);
        }
and
      if (((minfo->kind >> 10) & 31) == METAFN_KIND_ARG_TINFO)
        {
          if (eval_is_type (h1) != boolean_true_node)
            return throw_exception_nontype (loc, ctx, fun, non_constant_p,
                                            jump_target);
        }
So, instead of handling it in 110 functions and having to pass the extra
arguments that throw_exception_nontype needs to each it is handled in 2
spots only (well, 3, get_type_info_vec also throws similarly).

Thus I've committed https://forge.sourceware.org/marek/gcc/commit/75ebf08f3c5a

        Jakub

Reply via email to