Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

US055 09.02.3.5 [dcl.fct].18 Parameter with placeholder-type-specifier and default argument is valid but useless #54

Closed
wg21bot opened this issue Oct 23, 2019 · 2 comments
Labels
EWG Evolution rejected No consensus for a change.
Milestone

Comments

@wg21bot
Copy link
Collaborator

wg21bot commented Oct 23, 2019

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.

@wg21bot wg21bot added the EWG Evolution label Oct 23, 2019
@jfbastien
Copy link
Collaborator

jfbastien commented Nov 4, 2019

EWG Monday: http://wiki.edg.com/bin/view/Wg21belfast/US055

Does EWG want to consider US055 for C++20

F A
3 17

No consensus for change.

@jensmaurer
Copy link
Member

Rejected. There was no consensus to adopt this change.

@jensmaurer jensmaurer added the rejected No consensus for a change. label Nov 7, 2019
@cplusplus cplusplus deleted a comment from vittorioromeo Nov 13, 2019
@jensmaurer jensmaurer added this to the CD C++20 milestone Sep 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EWG Evolution rejected No consensus for a change.
Projects
None yet
Development

No branches or pull requests

3 participants