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
Defaulting an argument with a placeholder-type-specifier in an abbreviated function template is valid but useless. Calling the function without providing values for the default parameters will result in a deduction error.
void foo(std::integral auto i = 0) {}
foo(); // COMPILE FAILURE
foo(1); // Ok
This is also a problem for generic lambdas:
auto foo = [] (auto i = 0) {};
foo(); // COMPILE FAILURE
foo(1); // Ok
Proposed change:
This problem could potentially be resolved if the invented template parameter was assigned an appropriate default value, e.g. decltype() of the provided default argument, although this could not work if the default argument references other parameters in the function.
The text was updated successfully, but these errors were encountered:
Defaulting an argument with a placeholder-type-specifier in an abbreviated function template is valid but useless. Calling the function without providing values for the default parameters will result in a deduction error.
This is also a problem for generic lambdas:
Proposed change:
This problem could potentially be resolved if the invented template parameter was assigned an appropriate default value, e.g. decltype() of the provided default argument, although this could not work if the default argument references other parameters in the function.
The text was updated successfully, but these errors were encountered: