[Bug c++/123143] internal compiler error: in lookup_member, at cp/search.cc:1197

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Mar 1 00:06:18 GMT 2026


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 <mpolacek@gcc.gnu.org>:

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

commit r16-7828-gbaf734f6f3085248d151fe99674b61ddcf69eea3
Author: Marek Polacek <polacek@redhat.com>
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 <jason@redhat.com>


More information about the Gcc-bugs mailing list