https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123143
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Marek Polacek <[email protected]>: https://gcc.gnu.org/g:baf734f6f3085248d151fe99674b61ddcf69eea3 commit r16-7828-gbaf734f6f3085248d151fe99674b61ddcf69eea3 Author: Marek Polacek <[email protected]> Date: Wed Feb 25 16:05:17 2026 -0500 c++: ICE with scoped member variable template-id [PR123143] In this test we crash in lookup_member with s.S::template a<42> == 42 but not without the "S::". The problem is that lookup_member gets a TEMPLATE_DECL and not an identifier. In tsubst_expr/COMPONENT_REF for variable templates we should not go to the "Lookup the template functions" block; we should let finish_class_member_access_expr do the job. PR c++/123143 gcc/cp/ChangeLog: * pt.cc (tsubst_expr) <case COMPONENT_REF>: Check identifier_p before doing lookup for a template function. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/var-templ88.C: New test. Reviewed-by: Jason Merrill <[email protected]>
