[Bug c++/123866] ICE when calling annotations_of on member function.

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jan 29 11:36:23 GMT 2026


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123866

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:4f2a04726b97a79f5c0cdb4af8e589aebefea7ef

commit r16-7134-g4f2a04726b97a79f5c0cdb4af8e589aebefea7ef
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jan 29 12:34:59 2026 +0100

    c++: Fix ICE in eval_annotations_of [PR123866]

    eval_annotations_of throws if the passed in reflection handle is not
    eval_is_function (and various others).  Now, eval_is_function uses
    maybe_get_first_fn to look through BASELINK/OVERLOAD etc., but
    eval_annotations_of wasn't doing that and ICEd on
      else if (TYPE_P (r))
        r = TYPE_ATTRIBUTES (r);
      else if (DECL_P (r))
        r = DECL_ATTRIBUTES (r);
      else
        gcc_unreachable ();
    because r isn't a decl nor type (nor REFLECT_BASE earlier).

    2026-01-29  Jakub Jelinek  <jakub@redhat.com>

            PR c++/123866
            * reflect.cc (eval_annotations_of): Use maybe_get_first_fn.

            * g++.dg/reflect/annotations10.C: New test.


More information about the Gcc-bugs mailing list