Section: 3.3.2 [fund.ts::meta.trans.other] Status: TS Submitter: Michael Spertus Opened: 2014-05-26 Last modified: 2017-07-30
Priority: Not Prioritized
View all other issues in [fund.ts::meta.trans.other].
View all issues with TS status.
Discussion:
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.
[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.
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 packArgTypes
shall be complete types, (possibly cv-qualified)void
,
or arrays of unknown bound.If A1, A2,...
denotesArgTypes...
and
raw_invocation_type<Fn(ArgTypes...)>::type
is the function typeR(T1, T2, ...)
then letUi
be
decay<Ai>::type
ifAi
is an rvalue otherwiseTi
.
IfandFn
is a pointer to member type andT1
is
an rvalue reference, then letU1
be.
R(decay<T1>::type,
T2, ...)
Otherwise,raw_invocation_type<Fn(ArgTypes...)>::type
The member typedeftype
shall equalR(U1, U2, ...)
.
[2013-06-21 Rapperswil]
Accept for Fundamentals TS Working Paper
Proposed resolution:
This wording is relative to N4023.
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 packArgTypes
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 typedeftype
. Otherwise:
Let
A1, A2,
… denoteArgTypes...
Let
R(T1, T2, …)
denote
raw_invocation_type_t<Fn(ArgTypes...)>
Then the member typedef
type
shall name the function
typeR(U1, U2, …)
whereUi
isdecay_t<Ai>
ifdeclval<Ai>()
is an rvalue otherwiseTi
.Ifraw_invocation_type<Fn(ArgTypes...)>::type
is the function typeR(T1, T2, …)
andFn
is a pointer to member type andT1
is
an rvalue reference, thenR(decay<T1>::type,
.
T2, …)
Otherwise,raw_invocation_type<Fn(ArgTypes...)>::type
.