Unclear presentation style of template argument deduction rules
Section [temp.deduct.type]
Richard Smith

Created on 2016-10-11.00:00:00, last changed 2016-10-11.00:00:00.


Date: 2016-10-11.00:00:00

The presentation style of [temp.deduct.type] paragraph 8 results in a specification that is unclear, needlessly verbose, and incomplete. Specific problems include:

  • What does it mean for P and A to have one of a set of forms? Do they both have to have that form? (That doesn't happen; typically, only P contains template parameters)

  • In the introductory sentence, aren't T, TT, and i supposed to be the names of template parameters rather than template arguments?

  • In T[i], it appears we can deduce i, but not T (T can only be deduced in the form T[integer-constant]

  • What is an integer-constant supposed to be?

  • What is a cv-list?

  • Why can we not deduce const T from T? (Apparently you only get to deduce if both or neither type have a cv-list, whatever a cv-list is.)

  • We have extreme redundancy because, for instance, there is no way to say β€œin T (T::*)(T), you can deduce any of those Ts, and it's OK if some of the positions don't have a T”. So we have seven (!) forms of that construct, for all cases except the one where none of the three positions contain a T.

  • We have special case rules for pointers to member functions, even though they're not a special case and should be covered by the rule for pointers to members and the rule for functions.

  • We do not allow deducing a template template parameter's value from a template template argument β€” there is a TT<T> form, a TT<i> form, a template-name<T> form, and a template-name<i> form, but no TT<TT> form nor template-name<TT> form.

Date User Action Args
2016-10-11 00:00:00admincreate