Title
Unclear rules for deduction failure
Status
cd6
Section
13.10.3 [temp.deduct]
Submitter
James Widman

Created on 2013-07-31.00:00:00 last changed 27 months ago

Messages

Date: 2021-08-15.00:00:00

Proposed resolution (August, 2021):

Change 13.10.3.1 [temp.deduct.general] paragraph 8 as follows:

If a substitution results in an invalid type or expression, type deduction fails. An invalid type or expression is one that would be ill-formed, with a diagnostic required, if written in the same context using the substituted arguments.
Date: 2021-10-15.00:00:00

[Accepted as a DR at the October, 2021 meeting.]

According to 13.10.3 [temp.deduct] paragraph 8,

If a substitution results in an invalid type or expression, type deduction fails. An invalid type or expression is one that would be ill-formed, with a diagnostic required, if written using the substituted arguments.

Presumably the phrase “if written” refers to rewriting the template declaration in situ with the substituted arguments, rather than writing that type or expression at some arbitrary location, e.g.,

  void g(double) = delete;

  template<class T> auto f(T t) -> decltype(g(t));

  void g(int);

  void h() {
    typedef int T;
    T t = 42;
    g(t);  // Ok (I “wrote the substituted arguments”, and it seems fine)
    f(42); // Presumably substitution is meant to fail.
  }

Perhaps a clearer formulation could be used?

History
Date User Action Args
2022-08-19 07:54:33adminsetstatus: drwp -> cd6
2022-02-15 00:00:00adminsetstatus: dr -> drwp
2021-11-15 00:00:00adminsetmessages: + msg6580
2021-11-15 00:00:00adminsetstatus: drafting -> dr
2013-10-14 00:00:00adminsetstatus: open -> drafting
2013-07-31 00:00:00admincreate