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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Simon Martin <simar...@gcc.gnu.org>:

https://gcc.gnu.org/g:19831baf4904d09a74c7cf684a27b091947a610b

commit r15-3598-g19831baf4904d09a74c7cf684a27b091947a610b
Author: Simon Martin <si...@nasilyan.com>
Date:   Tue Sep 10 22:33:18 2024 +0200

    c++: Don't ICE to build private access error message [PR116323]

    We currently ICE upon the following code while building the "[...] is
    private within this context" error message

    === cut here ===
    class A { enum Enum{}; };
    template<typename E, template<typename> class Alloc>
    class B : private Alloc<E>, private A {};
    template<typename E, template<typename> class Alloc>
    int B<E, Alloc>::foo (Enum m) { return 42; }
    === cut here ===

    The problem is that since r11-6880, after detecting that Enum cannot be
    accessed in B, enforce_access will access the TYPE_BINFO of all the
    bases of B, which ICEs for any that is a BOUND_TEMPLATE_TEMPLATE_PARM.
    This patch simply skips such bases.

            PR c++/116323

    gcc/cp/ChangeLog:

            * search.cc (get_parent_with_private_access): Only call
access_in_type
            for RECORD_OR_UNION_TYPE_P base BINFOs.

    gcc/testsuite/ChangeLog:

            * g++.dg/template/access43.C: New test.

Reply via email to