CaseyCarter / cmcstl2

An implementation of C++ Extensions for Ranges
Other
221 stars 68 forks source link

transform.hpp iter_move violates access control #318

Closed jicama closed 5 years ago

jicama commented 5 years ago

The declaration of iter_move in transform.hpp looks like

            friend constexpr decltype(auto) iter_move(const __iterator& i)
                   noexcept(noexcept(invoke(i.parent_->fun_.get(), *i.current_)))

But this function is only a friend of __iterator, it has no special access to the fun_ member of transform_view, so GCC rejects this. A reduced example:

 class A
  {
    static int i;
  public:
    struct B
    {
      friend int return_i () { return i; }
    };
  };

Clang is the only compiler on godbolt that accepts this testcase.