https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124888
--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-16 branch has been updated by Jason Merrill <[email protected]>: https://gcc.gnu.org/g:9b8da2a0d40191f1b51dcff6aeec046f48593f35 commit r16-9588-g9b8da2a0d40191f1b51dcff6aeec046f48593f35 Author: Jason Merrill <[email protected]> Date: Mon Aug 24 11:00:21 2026 -0700 c++: modules vs typeid [PR124888] Instantiating a template from a TU which included <typeinfo> in an importing TU which didn't should still work. Instead of messing with lookup in the other TU, let's reuse the type that we already gave the TYPEID_EXPR. PR c++/124888 gcc/cp/ChangeLog: * pt.cc (tsubst_expr): Pass type to {get,build}_typeid. * rtti.cc (build_typeid, get_typeid): Take it. (type_info_ptr_type): Remove. (get_tinfo_ptr): Take tinfo_ptr_type instead of voidp. (get_tinfo_ptr_dynamic): Likewise. (get_void_tinfo_ptr): Pass const_ptr_type_node. * cp-tree.h (build_typeid, get_typeid): Adjust. gcc/testsuite/ChangeLog: * g++.dg/modules/typeid-2_a.C: New test. * g++.dg/modules/typeid-2_b.C: New test. (cherry picked from commit f1933b5ba13bb2abd1329cfb1ba9501c90f4c516)
