https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123143
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-15 branch has been updated by Marek Polacek <[email protected]>: https://gcc.gnu.org/g:d3240e544f5ea5e4983c38bc844c338dda1b127e commit r15-11124-gd3240e544f5ea5e4983c38bc844c338dda1b127e 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]> (cherry picked from commit baf734f6f3085248d151fe99674b61ddcf69eea3)
