[Bug c++/56071] friend class template cannot access private constructor in exception-specification

steveire at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jan 22 01:44:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56071

--- Comment #2 from Stephen <steveire at gmail dot com> 2013-01-22 01:44:19 UTC ---
Interestingly, add variadic templates to the mix and it compiles:


class B
{
  template <typename T> friend struct A;
private:
    B(int, char) {}
    ~B() {}
};

template <typename T>
struct A
{
    T t;
    template<typename... Args>
    A(Args&&... args) noexcept(noexcept(T(std::forward<Args>(args)...)))
      : t(std::forward<Args>(args)...)
    {}
};

struct C {
  A<B> delegate;

  template<typename... Args>
  C(Args&&... args)
      noexcept(noexcept(A<B>(std::forward<Args>(args)...)))
      : delegate(std::forward<Args>(args)...)
    { }
};



More information about the Gcc-bugs mailing list