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

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Extended testcase that also instantiates the friend function:

template <class T>
struct EnumeratorRange {
  struct Iterator {
    EnumeratorRange range_;

    friend bool f(Iterator i) { return i.range_.end_reached_; }
  };

 private:
  bool end_reached_;
};

int main() {
  EnumeratorRange<int>::Iterator i;
  f(i);
}

Before r11-6800, GCC rejected this testcase, however Clang accepts it.  ISTM we
were correct to reject because although members of a nested class have full
access to the enclosing class, a hidden friend function defined inside the
nested class isn't really a class member, so [class.access.nest] doesn't apply.

Reply via email to