This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
[Accepted as a DR at the November, 2022 meeting.]
Subclause 13.10.3.1 [temp.deduct.general] paragraph 7 specifies:
The substitution occurs in all types and expressions that are used in the function type and in template parameter declarations. The expressions include not only constant expressions such as those that appear in array bounds or as nontype template arguments but also general expressions (i.e., non-constant expressions) inside sizeof, decltype, and other contexts that allow non-constant expressions. The substitution proceeds in lexical order and stops when a condition that causes deduction to fail is encountered. If substitution into different declarations of the same function template would cause template instantiations to occur in a different order or not at all, the program is ill-formed; no diagnostic required.
[Note 4: The equivalent substitution in exception specifications is done only when the noexcept-specifier is instantiated, at which point a program is ill-formed if the substitution results in an invalid type or expression. —end note]
The note says that substitution into the noexcept-specifier occurs late, but the normative text does not support that, because the exception specification is part of the function type.
Subclause 13.10.3.1 [temp.deduct.general] paragraph 8 specifies:
Only invalid types and expressions in the immediate context of the function type, its template parameter types, and its explicit-specifier can result in a deduction failure.
However, paragraph 7 does not mention the explicit-specifier when describing the substitution.
Proposed resolution (approved by CWG 2022-09-09):
Change in 13.10.3.1 [temp.deduct.general] paragraph 7 as follows:
The deduction substitution loci are
The substitution occurs in all types and expressions that are used in the
- the function type outside of the noexcept-specifier,
- the explicit-specifier, and
- the template parameter declarations.
function type and in template parameter declarationsdeduction substitution loci. ...
Change in 13.10.3.1 [temp.deduct.general] paragraph 8 as follows:
...Only invalidInvalid types and expressions can result in a deduction failure only in the immediate context of thefunction type, its template parameter types, and its explicit-specifierdeduction substitution locican result in a deduction failure.