This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 110b. See for the official list.


2147. Initializer-list arguments and pack deduction

Section:  []     Status: CD4     Submitter: Hubert Tong     Date: 2015-06-22

[Adopted at the February, 2016 meeting.]

The current wording of [] paragraph 1 dealing with deduction for a trailing parameter pack refers to “the type” of the argument, which does not apply to an initializer list. There is implementation divergence in the handling of an example like

  #include <initializer_list>

  template <typename... T>
  void q(std::initializer_list<std::initializer_list<T>>... tt);

  void bar() { q({{0}}, {{'\0'}}); }

Proposed resolution (September, 2015):

Change [] paragraph 1 as follows:

...For a function parameter pack that occurs at the end of the parameter-declaration-list, the type A of deduction is performed for each remaining argument of the call, is compared with taking the type P of the declarator-id of the function parameter pack as the corresponding function template parameter type. Each comparison deduction deduces template arguments for subsequent positions in the template parameter packs expanded by the function parameter pack. When a function parameter pack appears in a non-deduced context ( [temp.deduct.type]), the type of that parameter pack is never deduced. [Example:...