Title
Nested class template argument deduction
Status
open
Section
12.2.2.9 [over.match.class.deduct]
Submitter
John Spicer

Created on 2021-01-26.00:00:00 last changed 1 month ago

Messages

Date: 2021-01-26.00:00:00

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.

History
Date User Action Args
2021-01-26 00:00:00admincreate