This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 113d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-03-20


2471. Nested class template argument deduction

Section: 12.2.2.9  [over.match.class.deduct]     Status: drafting     Submitter: John Spicer     Date: 2021-01-26

Consider the following example:

  template<class T> struct S {
    template<class U> struct N {
      N(T) {}
      N(T, U) {}
      template<class V> N(V, U) {}
    };
  };
  S<int>::N x{2.0, 1};

The description of CTAD in 12.2.2.9 [over.match.class.deduct] doesn't really specify how nested classes work. If you are supposed to deduce all the enclosing class template arguments, the example is ill-formed because there is no way to deduce T. If you are supposed to consider S<int>::N as having a new constructor template, then it should probably be well-formed.

Notes from the March, 2021 teleconference:

CWG agreed that the intent is to use the partially-instantiated inner template with the explicitly-specified template argument int.