Title
When do template parameters match?
Status
c++14
Section
13.4.4 [temp.arg.template]
Submitter
Richard Smith

Created on 2012-12-03.00:00:00 last changed 92 months ago

Messages

Date: 2013-09-15.00:00:00

[Moved to DR at the September, 2013 meeting.]

Date: 2013-06-15.00:00:00

Proposed resolution (June, 2013):

Change 13.4.4 [temp.arg.template] paragraph 3 as follows:

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 alias template (call it A) matches the corresponding template parameter in the template-parameter-list of P. Two template parameters match if they are of the same kind (type, non-type, template), for non-type template-parameters, their types are equivalent (13.7.7.2 [temp.over.link]), and for template template-parameters, each of their corresponding template-parameters matches, recursively. When P's template-parameter-list contains a template parameter pack...
Date: 2012-12-03.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 alias template (call it A) matches the corresponding template parameter in the template-parameter-list of P.

There does not appear to be a formal definition of the criteria for whether two template parameters “match,” however, and there is implementation variance in the treatment of an example like

  struct A {
    typedef int T1;
    typedef int T2;
  };
  template<template<typename T, typename T::T1 N> class U>
  struct B {
    U<A, 0> u;
  };
  template<typename T, typename T::T2 N>
  struct C {
  };
  B<C> b; // ok?
History
Date User Action Args
2014-11-24 00:00:00adminsetstatus: drwp -> c++14
2014-03-03 00:00:00adminsetstatus: dr -> drwp
2013-10-14 00:00:00adminsetmessages: + msg4700
2013-10-14 00:00:00adminsetstatus: tentatively ready -> dr
2013-09-03 00:00:00adminsetmessages: + msg4467
2013-09-03 00:00:00adminsetstatus: drafting -> tentatively ready
2013-05-03 00:00:00adminsetstatus: open -> drafting
2012-12-03 00:00:00admincreate