You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the current draft, there's no formal provision that can prove the example is ill-formed. The only potential relevant rules are
[temp.deduct.decl] p2
If, for the set of function templates so considered, there is either no match or more than one match after partial ordering has been considered ([temp.func.order]), deduction fails and, in the declaration cases, the program is ill-formed.
"match" is vague and it is not sufficiently clear, consider the following example
The "match" may have a clear definition instead. Such as
The function type of an explicit specialization shall be identical to the function type of the specialization that would be implicitly instantiated from the function template, except that, the function template has a declared return type that uses a placeholder type, which case is specified in [dcl.spec.auto].
The explicit instantiation declaration for a function template may have a similar restriction as to the above. Or, we should have a reference to [temp.deduct.decl] in a general rule for explicit specialization of a function template instead just mentions [temp.deduct.decl] in paragraph [temp.expl.spec] p10 that is not suitable for template<> void fun<int>(int);. BTW, since [temp.deduct.decl] p1 references to [temp.deduct.type] but that section lacks to specify the deduction of function type's return type with the form T.
The text was updated successfully, but these errors were encountered:
xmh0511
changed the title
Lacks the restriction on "return type" in the explicit function template instantiation/specialization
Lacks an explicit restriction on "return type" in the explicit function template instantiation/specialization
Dec 22, 2021
xmh0511
changed the title
Lacks an explicit restriction on "return type" in the explicit function template instantiation/specialization
Lack an explicit restriction on "return type" in the explicit function template instantiation/specialization
Dec 22, 2021
In the current draft, there's no formal provision that can prove the example is ill-formed. The only potential relevant rules are
[temp.deduct.decl] p2
"match" is vague and it is not sufficiently clear, consider the following example
The above example is accepted by all implementations, what does "match" mean in this example?
@jensmaurer @opensdh
The "match" may have a clear definition instead. Such as
The explicit instantiation declaration for a function template may have a similar restriction as to the above. Or, we should have a reference to [temp.deduct.decl] in a general rule for explicit specialization of a function template instead just mentions [temp.deduct.decl] in paragraph [temp.expl.spec] p10 that is not suitable for
template<> void fun<int>(int);
. BTW, since [temp.deduct.decl] p1 references to [temp.deduct.type] but that section lacks to specify the deduction of function type's return type with the formT
.The text was updated successfully, but these errors were encountered: