3023. Clarify unspecified call wrappers

Section: 23.14.12 [func.memfn], 23.14.10 [func.not_fn], 23.14.11 [func.bind] Status: New Submitter: Detlef Vollmann Opened: 2017-10-07 Last modified: 2017-11-10

Priority: 3

View all other issues in [func.memfn].

View all issues with New status.

Discussion:

Even after the discussion on the reflector, starting with this reflector message it's not completely clear that unspecified as return type of mem_fn really means 'unspecified, but always the same'. The same problem exists for bind() and not_fn().

Possible solution:

Specify in 23.14.2 [func.def] or 23.14.3 [func.require] that a call wrapper type is always the same for forwarding call wrappers if the object is returned by a function with the same parameter types. And also put into 23.14.10 [func.not_fn] that a call_wrapper object is a simple call wrapper.

[2017-11 Albuquerque Wednesday night issues processing]

Priority set to 3. Tomasz to write a paper that will address this issue. See also 3015

[2017-11-10, Tomasz comments and provides wording together with STL]

From the core language rules it is already required that same function template specialization have the same return type. Given that the invocation of mem_fn/bind/not_fn will always return the same wrapper type, if they are instantiated (called with) same parameters type. However, the existence of this issue, shows that some library-wide clarification note would be welcomed.

Proposed resolution:

This wording is relative to N4700.

  1. After section 20.4.2.1.2 [expos.only.types] "Exposition-only types" add the following new section:

    ?.?.?.?.? unspecified types [unspecified.types]

    [Note: Whenever the return type of a function template is declared as unspecified, the return type depends only on the template arguments of the specialization. Given the example:

    template<class T> unspecified f(T);
    

    the expressions f(0) and f(1) have the same type. — end note]