[Bug c++/124756] [reflection] Internal compiler error when creating reflection of block-scope function within template

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri May 1 13:39:34 GMT 2026


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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:f2edcf0590c3cecbce3899eceac155c1659adbbb

commit r16-8850-gf2edcf0590c3cecbce3899eceac155c1659adbbb
Author: Marek Polacek <polacek@redhat.com>
Date:   Fri Apr 24 17:30:43 2026 -0400

    c++/reflection: disallow reflecting block-scope externs (CWG 3065)
[PR124756]

    The proposed resolution of CWG 3065 suggests that reflection on a
block-scope
    extern declaration be ill-formed.  This patch makes it so, and it also
    happens to fix a crash.

            PR c++/124756

    gcc/cp/ChangeLog:

            * reflect.cc (get_reflection): Give an error when taking the
            reflection of a block-scope extern.

    gcc/testsuite/ChangeLog:

            * g++.dg/reflect/identifier_of3.C: Add dg-error.
            * g++.dg/reflect/pr123612.C: Likewise.
            * g++.dg/reflect/error13.C: New test.

    Reviewed-by: Jason Merrill <jason@redhat.com>
    (cherry picked from commit c1977d101524d87642790422134fe170ce00b545)


More information about the Gcc-bugs mailing list