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

2020-05-01 Thread ppalka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90880

Patrick Palka  changed:

   What|Removed |Added

 Resolution|--- |FIXED
   Target Milestone|--- |11.0
 Status|ASSIGNED|RESOLVED

--- Comment #6 from Patrick Palka  ---
Fixed for GCC 11.

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

2020-05-01 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90880

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Patrick Palka :

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

commit r11-21-g4f6c1ca287d2c64856ef67fa50bc462633d5b8cf
Author: Patrick Palka 
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.

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

2020-03-20 Thread ppalka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90880

Patrick Palka  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

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

2019-06-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90880

--- Comment #4 from Jonathan Wakely  ---
(In reply to Federico Kircheis from comment #3)
> Sorry if linking to external bug trackers in comments is bad practice, but I
> did not saw any rule about it.

There's no rule against it, it's useful.

> Since it could be interesting for those having this issue, here is the bug
> report for MSVC: 
> 
> https://developercommunity.visualstudio.com/content/problem/607019/incorrect-
> decltype-on-non-public-member-variables.html

Thanks.

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

2019-06-13 Thread federico.kircheis at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90880

--- Comment #3 from Federico Kircheis  ---
(In reply to Jonathan Wakely from comment #2)
> (In reply to Federico Kircheis from comment #1)
> > After researching a little bit more, I've convinced myself that
> > `status::value` should be false, as `decltype` has no special rules for
> > accessing private data, thus clang is correct.
> 
> Agreed. And G++ should accept it.


Thank you.

Sorry if linking to external bug trackers in comments is bad practice, but I
did not saw any rule about it.
Since it could be interesting for those having this issue, here is the bug
report for MSVC: 

https://developercommunity.visualstudio.com/content/problem/607019/incorrect-decltype-on-non-public-member-variables.html

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

2019-06-13 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90880

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords||rejects-valid
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-06-13
 Ever confirmed|0   |1

--- Comment #2 from Jonathan Wakely  ---
(In reply to Federico Kircheis from comment #1)
> After researching a little bit more, I've convinced myself that
> `status::value` should be false, as `decltype` has no special rules for
> accessing private data, thus clang is correct.

Agreed. And G++ should accept it.

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

2019-06-13 Thread federico.kircheis at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90880

--- Comment #1 from Federico Kircheis  ---
After researching a little bit more, I've convinced myself that
`status::value` should be false, as `decltype` has no special rules for
accessing private data, thus clang is correct.

If someone could confirm this, I could try to make a bug report to the msvc
team