Title
Length mismatch in template type deduction
Status
open
Section
13.10.3.6 [temp.deduct.type]
Submitter
Canada

Created on 2013-09-23.00:00:00 last changed 135 months ago

Messages

Date: 2013-09-15.00:00:00

Notes from the September, 2013 meeting:

CWG agreed that this example should not be accepted. The existing rules seem to cover this case (deduction is not specified to “succeed,” so it's a reasonable conclusion that it fails), but it might be helpful to be clearer.

Date: 2022-02-18.07:47:23
N3690 comment CA 4

It is not clear how an example like the following is to be handled:

  template <typename U>
  struct A {
    template <typename V> operator A<V>();
  };

  template <typename T>
  void foo(A<void (T)>);

  void foo();

  int main() {
    A<void (int, char)> a;
    foo<int>(a);
    foo(a); // deduces T to be int
  }

In sub13.10.3.6 [temp.deduct.type] paragraph 10, deduction from a function type considers P/A pairs from the parameter-type-list only where the "P" function type has a parameter. Deduction is not specified to fail if there are additional parameters in the corresponding "A" function type.

History
Date User Action Args
2013-10-14 00:00:00adminsetmessages: + msg4671
2013-09-23 00:00:00admincreate