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

            Bug ID: 114889
           Summary: [modules] ICE in friend_accessible_p with imported
                    class template specialization befriending class
                    template
           Product: gcc
           Version: 14.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_a.C
export module mymod;

template <typename, typename>
struct _Hashtable;

export
template <typename _Key, typename _Val>
struct _Map_base {
  void f() {
    _Hashtable<_Key, _Val> __h;
    __h._M_hash_code(0);
  }
};

template <typename _Key, typename _Value>
struct _Hashtable {
  template <typename, typename> friend struct _Map_base;
protected:
  void _M_hash_code(int);
};

_Hashtable<int, int> m;

$ cat testcase_b.C
import mymod;

int main() {
  _Map_base<int, int> m;
  m.f();
}

$ g++ -fmodules-ts testcase_*
In module mymod, imported at testcase_b.C:1:
testcase_a.C: In instantiation of ‘void _Map_base@mymod<_Key, _Val>::f() [with
_Key = int; _Val = int]’:
testcase_b.C:5:6:   required from here
    5 |   m.f();
      |   ~~~^~
testcase_a.C:11:21: internal compiler error: in friend_accessible_p, at
cp/search.cc:803
   11 |     __h._M_hash_code(0);
      |     ~~~~~~~~~~~~~~~~^~~

Reply via email to