Title
Deduction in type-constraints
Status
open
Section
13.10.3.7 [temp.deduct.decl]
Submitter
Richard Smith

Created on 2023-03-30.00:00:00 last changed 22 months ago

Messages

Date: 2023-03-30.00:00:00

Consider:

  template<typename T, typename U> concept C = true;
  template<typename T> C<T> auto f() { return 0; }
  template C<int> auto f();

Is that valid? Or is the following needed:

  template C<int> auto f<int>();

The specification neither discusses deduction from a type-constraint nor treating it as a non-deduced context.

Possible resolution:

Change in 13.10.3.6 [temp.deduct.type] paragraph 5 as follows:

The non-deduced contexts are:
  • The nested-name-specifier of a type that was specified using a qualified-id.
  • A pack-index-specifier or a pack-index-expression.
  • A type-constraint.
  • The expression of a decltype-specifier.
  • ...
History
Date User Action Args
2023-03-30 00:00:00admincreate