]> gcc.gnu.org Git - gcc.git/commit
c++: Missing SFINAE with inaccessible static data member [PR90880]
authorPatrick Palka <ppalka@redhat.com>
Fri, 1 May 2020 20:18:19 +0000 (16:18 -0400)
committerPatrick Palka <ppalka@redhat.com>
Fri, 1 May 2020 20:37:57 +0000 (16:37 -0400)
commit4f6c1ca287d2c64856ef67fa50bc462633d5b8cf
tree24cfe5a8dd12327815e4d4e7566b6e0b7d2dcd9c
parent30da2906ac521749aef8260fc1d942e62073f19d
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.
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/sfinae29.C [new file with mode: 0644]
This page took 0.0575290000000001 seconds and 5 git commands to generate.