wg21.cmeerw.net

Consider:

    template <class... T>
    void f(T..., int, T...) { }
    int main() {
       f(0);          // OK
       f<int>(0,0,0); // OK
       f(0,0,0);      // error
    }

It seems clear that the third call is ill-formed because by the time we get to the second function parameter pack we've already assumed that T is empty, so deducing anything for T would be nonsensical. But I don't think this is expressed anywhere in the standard.

One way to handle this would be to say that a template parameter pack is not deducible if it is used in a function parameter pack not at the end of the parameter list.

History Date User Action Args 2014-03-03 00:00:00adminsetstatus: drwp -> cd3 2013-05-03 00:00:00adminsetstatus: dr -> drwp 2012-11-03 00:00:00adminsetmessages: + msg4164 2012-11-03 00:00:00adminsetstatus: ready -> dr 2012-09-24 00:00:00adminsetstatus: drafting -> ready 2012-02-27 00:00:00adminsetmessages: + msg3774 2012-02-27 00:00:00adminsetstatus: open -> drafting 2011-09-29 00:00:00admincreate

Read the original on wg21.cmeerw.net ↗