Title
[fund.ts] Invocation types and rvalues
Status
open
Section
[meta.trans.other]
Submitter
Michael Spertus

Created on 2014-05-26.00:00:00 last changed 89 months ago

Messages

Date: 2014-10-13.18:44:16

Proposed resolution:

This wording is relative to N4023.

  1. Change Table 3, [meta.trans.other] in the Library TS as indicated:

    Table 3 — Other type transformations
    Template Condition Comments
    template <class Fn, class... ArgTypes>
    struct invocation_type<Fn(ArgTypes...)>;
    Fn and all types in the parameter pack ArgTypes
    shall be complete types, (possibly cv-qualified) void,
    or arrays of unknown bound.
    The nested typedef invocation_type<Fn(ArgTypes...)>::type
    shall be defined as follows. If
    raw_invocation_type<Fn(ArgTypes...)>::type
    does not exist, there shall be no member typedef type. Otherwise:
    • Let A1, A2, … denote ArgTypes...

    • Let R(T1, T2, …) denote
      raw_invocation_type_t<Fn(ArgTypes...)>

    • Then the member typedef type shall name the function
      type R(U1, U2, …) where Ui is decay_t<Ai>
      if declval<Ai>() is an rvalue otherwise Ti.

    If raw_invocation_type<Fn(ArgTypes...)>::type
    is the function type R(T1, T2, …)
    and Fn is a pointer to member type and T1 is
    an rvalue reference, then R(decay<T1>::type,
    T2, …)
    .
    Otherwise, raw_invocation_type<Fn(ArgTypes...)>::type.
Date: 2013-06-21.00:00:00

[ 2013-06-21 Rapperswil ]

Accept for Fundamentals TS Working Paper

Date: 2014-06-15.00:00:00

[ 2014-06-18, Rapperswil ]

Mike Spertus, Richard Smith, Jonathan Wakely, and Jeffrey Yasskin suggest improved wording.

Previous resolution [SUPERSEDED]:

This wording is relative to N3908.

  1. Change Table 3, [meta.trans.other] in the Library TS as indicated:

    Table 3 — Other type transformations
    Template Condition Comments
    template <class Fn, class... ArgTypes>
    struct invocation_type<Fn(ArgTypes...)>;
    Fn and all types in the parameter pack ArgTypes
    shall be complete types, (possibly cv-qualified) void,
    or arrays of unknown bound.
    If A1, A2,... denotes ArgTypes... and
    raw_invocation_type<Fn(ArgTypes...)>::type
    is the function type R(T1, T2, ...) then let Ui be
    decay<Ai>::type if Ai is an rvalue otherwise Ti.
    If
    and Fn is a pointer to member type and T1 is
    an rvalue reference, then let U1 be R(decay<T1>::type,
    T2, ...)
    .
    Otherwise, raw_invocation_type<Fn(ArgTypes...)>::type
    The member typedef type shall equal R(U1, U2, ...).
Date: 2014-05-26.00:00:00

Addresses: fund.ts

invocation_type falls short of its stated goals in the following case. Using the notation of Invocation type traits, consider

void f(int const& i);
more_perfect_forwarding_async(f, int(7)); // Oops. Dangling reference because rvalue gone when async runs

This was always the advertised intent of the proposal, but while the language reflects this for the first parameter in the case of a member pointer, it failed to include corresponding language for other parameters.

History
Date User Action Args
2017-07-30 20:10:41adminsetstatus: wp -> open
2014-10-13 18:44:16adminsetmessages: + msg7152
2014-10-13 18:44:16adminsetstatus: immediate -> wp
2014-06-19 12:15:04adminsetstatus: open -> immediate
2014-06-18 21:12:29adminsetmessages: + msg7067
2014-06-18 21:12:29adminsetstatus: new -> open
2014-05-29 13:26:29adminsetmessages: + msg6978
2014-05-26 00:00:00admincreate