Title
Matching template arguments with template template parameters with parameter packs
Status
cd2
Section
13.4.4 [temp.arg.template]
Submitter
Faisal Vali

Created on 2008-11-02.00:00:00 last changed 143 months ago

Messages

Date: 2010-03-15.00:00:00

[Voted into WP at March, 2010 meeting.]

Date: 2010-02-15.00:00:00

Proposed resolution (February, 2010):

Change the final three lines of the second example in 13.4.4 [temp.arg.template] paragraph 2 as follows:

    Y<A> ya;  // ill-formed: a template parameter pack does not match a template parameter OK
    Y<B> yb;  // ill-formed: a template parameter pack does not match a template parameter OK
    Y<C> yc;  // OK
Date: 2008-11-02.00:00:00

According to 13.4.4 [temp.arg.template] paragraph 3,

A template-argument matches a template template-parameter (call it P) when each of the template parameters in the template-parameter-list of the template-argument's corresponding class template or template alias (call it A) matches the corresponding template parameter in the template-parameter-list of P. When P's template-parameter-list contains a template parameter pack (13.7.4 [temp.variadic]), the template parameter pack will match zero or more template parameters or template parameter packs in the template-parameter-list of A with the same type and form as the template parameter pack in P (ignoring whether those template parameters are template parameter packs).

The immediately-preceding example, however, assumes that a parameter pack in the parameter will match only a parameter pack in the argument:

    template<class T> class A { /* ... */ };
    template<class T, class U = T> class B { /* ... */ };
    template<class ... Types> class C { /* ... */ };

    template<template<class ...> class Q> class Y { /* ... */ };

    Y<A> ya;  // ill-formed: a template parameter pack does not match a template parameter
    Y<B> yb;  // ill-formed: a template parameter pack does not match a template parameter
    Y<C> yc;  // OK
History
Date User Action Args
2010-03-29 00:00:00adminsetmessages: + msg2733
2010-03-29 00:00:00adminsetstatus: tentatively ready -> cd2
2010-02-16 00:00:00adminsetmessages: + msg2509
2010-02-16 00:00:00adminsetstatus: drafting -> tentatively ready
2009-08-03 00:00:00adminsetstatus: open -> drafting
2008-11-02 00:00:00admincreate