[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 via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
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 <[email protected]>:

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

commit r17-3479-g151ded854245c1578706a9da4843f17f55de33d0
Author: Odysseas Georgoudis <[email protected]>
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 <[email protected]>
    Co-authored-by: Jason Merrill <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.