Open xmh0511 opened 3 weeks ago
[dcl.fct] p3 (as quoted) says "Except for this special case, a parameter shall not have type cv void."
That is not a statement on the return type. The example you gave has no parameters.
I think the part that @xmh0511 takes issue with is this, from [dcl.type.auto.deduct]/3:
[...] Obtain P from T by replacing the occurrences of type-constraintopt auto either with a new invented type template parameter U or, if the initialization is copy-list-initialization, with std::initializer_list. Deduce a value for U using the rules of template argument deduction from a function call, where P is a function template parameter type and the corresponding argument is E. [...]
If P
is a function template parameter type, then it has a corresponding invented function template. And if P
is U
where U
is a template parameter, can deduction succeed when the corresponding argument in the call is void()
? [temp.deduct.general]/11.10 seems to say no.
We seemingly want to use all the rules from [temp.deduct.general] that actually tell us how to find U
, but without actually imposing the substitution specified by [temp.deduct.general]/5.
Full name of submitter (unless configured in github; will be published with the issue): Jim X
Consider this case:
[dcl.type.auto.deduct] p2.1.1 says:
[dcl.type.auto.deduct] p3 says:
[temp.deduct.general] p8 says:
[dcl.fct] p3 says;
violate [dcl.fct] p3 would case the program is ill-formed. So, the deduction for
void()
with template parameter typeU
isvoid
, substitutes this type would result in an invalid function type, hence [dcl.type.auto.deduct] p3 says the declaration is ill-formed. However, this is a legal use.