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

[expr.type.conv] Awkward invented declaration in P0849 #4745

Closed
opensdh opened this issue Jul 12, 2021 · 0 comments · Fixed by #5039
Closed

[expr.type.conv] Awkward invented declaration in P0849 #4745

opensdh opened this issue Jul 12, 2021 · 0 comments · Fixed by #5039
Assignees
Milestone

Comments

@opensdh
Copy link
Contributor

opensdh commented Jul 12, 2021

For @jensmaurer: the version approved by CWG (pending review by LWG) contains in [expr.type.conv]/1

Otherwise, if the type is auto, it is replaced by the type deduced for the variable x in the invented declaration ([dcl.spec.auto]), which is never interpreted as a function declaration:

auto x init;

, where init is the initializer.

The appositive with the intervening relative clause and colon is a bit broken, as is the trailing comma. My preferred means of addressing this is to replace the whole sentence with

Otherwise, if the type is auto, it is replaced by the type determined by placeholder type deduction ([dcl.spec.auto.deduct]).

and add a bullet to [dcl.spec.auto.deduct]/2:

  • for an explicit type conversion ([expr.type.conv]), T is auto and E is the initializer.

Using auto explicitly rather than referring to "the specified type" avoids an ordering question with the replacement of that auto with the deduced type.

@jensmaurer jensmaurer changed the title Awkward invented declaration in P0849 [expr.type.conv] Awkward invented declaration in P0849 Oct 15, 2021
@jensmaurer jensmaurer added this to the post-2021-10 milestone Oct 15, 2021
@jensmaurer jensmaurer self-assigned this Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants