2574. [fund.ts.v2] std::experimental::function::operator=(F&&) should be constrained

Section: 4.2.1 [fund.ts.v2::func.wrap.func.con] Status: TS Submitter: Tim Song Opened: 2015-12-05 Last modified: 2017-07-30

Priority: 0

View all other issues in [fund.ts.v2::func.wrap.func.con].

View all issues with TS status.

Discussion:

Addresses: fund.ts.v2

LWG 2132 constrained std::function's constructor and assignment operator from callable objects for C++14. The constructors of std::experimental::function isn't separately specified in the fundamentals TS and so inherited the constraints from C++14, but the assignment operator is separately specified and presumably needs to be constrained.

[2016-02, Issues Telecon]

P0; move to Tentatively Ready.

Proposed resolution:

This wording is relative to N4562.

  1. Insert a paragraph after 4.2.1 [fund.ts.v2::func.wrap.func.con]/15 as indicated:

    template<class F> function& operator=(F&& f);
    

    -14- Effects: function(allocator_arg, ALLOCATOR_OF(*this), std::forward<F>(f)).swap(*this);

    -15- Returns: *this.

    -?- Remarks: This assignment operator shall not participate in overload resolution unless declval<decay_t<F>&>() is Callable (C++14 §20.9.11.2) for argument types ArgTypes... and return type R.