[Bug c++/124983] [15/16/17 Regression] ICE with using typename T::Name and then doing this->name() in method of a template struct

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Aug 20 19:11:05 GMT 2026


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

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:151ded854245c1578706a9da4843f17f55de33d0

commit r17-3479-g151ded854245c1578706a9da4843f17f55de33d0
Author: Odysseas Georgoudis <odygrd@hotmail.com>
Date:   Sun Jul 26 23:48:20 2026 +0100

    c++: Avoid access check for dependent lookup result [PR124983]

    strip_using_decl turns a dependent typename USING_DECL into a dependent
    TYPE_DECL.  If member lookup finds that declaration while looking for a
    typo correction, lookup_member can therefore try to perform an access
    check on it.  Access checks for dependent declarations need to wait until
    substitution, and enforce_access asserts this invariant.

    Skip the access check whenever the lookup result refers to a member of a
    dependent scope, not just when it remains a USING_DECL.

    gcc/cp/ChangeLog:

            PR c++/124983
            * search.cc (lookup_member): Skip access checks for declarations
            from dependent scope.

    gcc/testsuite/ChangeLog:

            PR c++/124983
            * g++.dg/template/pr124983.C: New test.

    Signed-off-by: Odysseas Georgoudis <odygrd@hotmail.com>
    Co-authored-by: Jason Merrill <jason@redhat.com>


More information about the Gcc-bugs mailing list