You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a function parameter pack that occurs at the end of the parameter-declaration-list, deduction is performed for each remaining argument of the call, taking the type P of the declarator-id of the function parameter pack as the corresponding function template parameter type.
The formal example after this rule:
template<classT1, class ... Types> voidg1(Types ..., T1);
g1(x, y, z); // error: Types is not deduced
However, we have implied that a template parameter pack can accept zero arguments and be deduced an empty sequence of template arguments in [temp.arg.explicit] p4
[Note 1: A trailing template parameter pack ([temp.variadic]) not otherwise deduced will be deduced as an empty sequence of template arguments. — end note]
That is, it also does not matter if Types is not deduced. I think the real reason why the above example is an error is that T1 is not deduced. In addition, the requirement of performing the deduction for a function parameter pack is that the pack should occur at the end of the parameter-declaration-list. Does the deduction really need that requirement?
U is deduced with UniqueType<0>. T is deduced with an empty sequence. The behavior is more and less related to the above rule: T is not deduced and otherwise deduced to an empty, U and Y participate in the deduction. If this result is the intent of the standard, the comment in the above should also be changed to
// error: Types is deduced to empty, wrong number of arguments
The text was updated successfully, but these errors were encountered:
The formal example after this rule:
However, we have implied that a template parameter pack can accept zero arguments and be deduced an empty sequence of template arguments in [temp.arg.explicit] p4
That is, it also does not matter if
Types
is not deduced. I think the real reason why the above example is an error is thatT1
is not deduced. In addition, the requirement of performing the deduction for a function parameter pack is that the pack should occur at the end of the parameter-declaration-list. Does the deduction really need that requirement?Consider an example in the GCC bug file list
U
is deduced withUniqueType<0>
. T is deduced with an empty sequence. The behavior is more and less related to the above rule:T
is not deduced and otherwise deduced to an empty,U
andY
participate in the deduction. If this result is the intent of the standard, the comment in the above should also be changed toThe text was updated successfully, but these errors were encountered: