[Bug c++/90880] compile error instead of SFINAE with non-public member variables

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri May 1 20:39:05 GMT 2020


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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:4f6c1ca287d2c64856ef67fa50bc462633d5b8cf

commit r11-21-g4f6c1ca287d2c64856ef67fa50bc462633d5b8cf
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri May 1 16:18:19 2020 -0400

    c++: Missing SFINAE with inaccessible static data member [PR90880]

    This is a missing SFINAE issue when verifying the accessibility of a
    static data member.

    The cause is that check_accessibility_of_qualified_id unconditionally
    passes tf_warning_or_error to perform_or_defer_access_check, even when
    called from tsubst_qualified_id(..., complain=tf_none).

    This patch fixes this by plumbing 'complain' from tsubst_qualified_id
    through check_accessibility_of_qualified_id to reach
    perform_or_defer_access_check, and by giving
    check_accessibility_of_qualified_id the appropriate return value.

    gcc/cp/ChangeLog:

            PR c++/90880
            * cp-tree.h (check_accessibility_of_qualified_id): Add
            tsubst_flags_t parameter and change return type to bool.
            * parser.c (cp_parser_lookup_name): Pass tf_warning_to_error to
            check_accessibility_of_qualified_id.
            * pt.c (tsubst_qualified_id): Return error_mark_node if
            check_accessibility_of_qualified_id returns false.
            * semantics.c (check_accessibility_of_qualified_id): Add
            complain parameter.  Pass complain instead of
            tf_warning_or_error to perform_or_defer_access_check.  Return
            true unless perform_or_defer_access_check returns false.

    gcc/testsuite/ChangeLog:

            PR c++/90880
            * g++.dg/template/sfinae29.C: New test.


More information about the Gcc-bugs mailing list