Title
Clarify partial ordering involving variadic templates
Status
open
Section
13.10.3.5 [temp.deduct.partial]
Submitter
Richard Smith

Created on 2025-01-30.00:00:00 last changed 1 week ago

Messages

Date: 2026-02-01.10:02:05

Suggested resolution:

Change in 13.10.3.5 [temp.deduct.partial] paragraph 8 as follows:

Using the resulting types P and A, the deduction is then done as described in [temp.deduct.type]. If P is a function parameter pack, the type A of each remaining parameter type of the argument template is compared with the type P of the declarator-id of the function parameter pack is compared with the type A of each remaining parameter type of the argument template. Each comparison deduces template arguments for subsequent positions in the template parameter packs expanded by the function parameter pack. Similarly, if A was transformed from a function parameter pack, it is compared with each remaining parameter type of the parameter template is compared with the corresponding expansion of A. If deduction succeeds for a given type, the type from the argument template is considered to be at least as specialized as the type from the parameter template.
Date: 2025-01-30.00:00:00

Consider:

  template<typename ...T> void f(T*...);
  template<typename U> void f(U, U);
This ought to be ambiguous, because the analoguous non-variadic case is ambiguous:
  template<typename T1, typename T2> void f(T1*, T2*);
  template<typename U> void f(U, U);

Furthermore, the wording in 13.10.3.5 [temp.deduct.partial] paragraph 8 should use the canonical ordering "P is compared with A" when presenting P vs. A matching.

History
Date User Action Args
2026-02-01 10:02:05adminsetmessages: + msg8469
2025-01-30 00:00:00admincreate