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

            Bug ID: 98662
           Summary: checking ICE in friend_accessible_p since r227023
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppalka at gcc dot gnu.org
  Target Milestone: ---

$ cat testcase.C
template <class T>
struct S {
  friend int f(S) {
    S<const T> y;
    (void) y.i;
    (void) y.j;
    return 0;
  }
private:
  int i;
protected:
  int j;
};

extern S<int> s;
int a = f(s);

$ g++ testcase.C
testcase.C: In instantiation of ‘int f(S<int>)’:
testcase.C:18:12:   required from here              
testcase.C:8:14: internal compiler error: in friend_accessible_p, at
cp/search.c:732
    8 |     (void) y.j; // { dg-error "protected" }               
      |            ~~^                                                          
0x6c4b3c friend_accessible_p                                                    
        /home/patrick/gcc/gcc/cp/search.c:732
0xad439d friend_accessible_p                                                    
        /home/patrick/gcc/gcc/cp/search.c:724
0xad4662 dfs_accessible_post                                                    
        /home/patrick/gcc/gcc/cp/search.c:792
0xad2762 dfs_walk_once_accessible_r                                             
        /home/patrick/gcc/gcc/cp/search.c:1588
0xad3012 accessible_p(tree_node*, tree_node*, bool)                
        /home/patrick/gcc/gcc/cp/search.c:889
0xad54f3 enforce_access                                                         
        /home/patrick/gcc/gcc/cp/semantics.c:314
0xad5931 perform_or_defer_access_check(tree_node*, tree_node*, tree_node*, int,
access_failure_info*)
        /home/patrick/gcc/gcc/cp/semantics.c:403
0xad1995 lookup_member(tree_node*, tree_node*, int, bool, int,
access_failure_info*)
        /home/patrick/gcc/gcc/cp/search.c:1176
0xb2bc86 finish_class_member_access_expr(cp_expr, tree_node*, bool, int)
        /home/patrick/gcc/gcc/cp/typeck.c:3188
...

Reply via email to