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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Pawel Tomulik from comment #2)
> Anyway, adding explicit to S(T&&) solves the problem...

Or constrain your greedy template so it only accepts arguments that can be
assigned to S::i_

struct S {
  int i_;

  template<typename T,
           typename Require = decltype(std::declval<int&>()
                                       = std::declval<T>())>
  S(T&& i)
    noexcept(noexcept(i_ = i))
  { i_ = i; }

  S() noexcept : i_{0} {};
};

Reply via email to