-
Notifications
You must be signed in to change notification settings - Fork 7
CWG2845 [temp.param] Make the type of lambda with no capture a structural type #459
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
Comments
This is a feature request, not a CWG issue: The standard is clear as written. If you wish to pursue this feature request further, please submit a paper to WG21 for processing in EWG. See https://isocpp.org/std/submit-a-proposal for details. |
FWIW, the status quo is not so that broken IMO - e.g. we can still write |
Full name of submitter (unless configured in github; will be published with the issue): Runge C.
Reference (section label): [expr.prim.lambda.closure] and [temp.param]
Link to reflector thread (if any):
Issue description:
After CWG2542 was adopted, closure type is not a structural type as specified directly in [expr.prim.lambda.closure]/3:
However, there's no good reason why we should make all closure types non-structural since a closure object with no capture has already perfectly met the original definition of structural type. Notice closure type with generic lambda is not convertible to some function pointer (if did not specialize it) so IMO allowing them could improve the expressiveness (and/or, usability) of NTTP, especially in the current situation that we have accepted a facility proposal related to NTTP callable (P2714).
Suggested resolution:
Resolution 1
In [expr.prim.lambda.closure]/3:
Then in [temp.param]/7:
Or:
Resolution 2
In [expr.prim.lambda.closure]/3:
The text was updated successfully, but these errors were encountered: