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] Move description of 'auto' deduction to [dcl.type.auto.deduct] #5039

Merged
merged 1 commit into from Oct 21, 2021

Conversation

tkoeppe
Copy link
Contributor

@tkoeppe tkoeppe commented Oct 19, 2021

Fixes #4745.

See #5015 for discussion and suggestions.

@jensmaurer jensmaurer added the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Oct 20, 2021
@jensmaurer
Copy link
Member

@tkoeppe, this needs a rebase after the force-push to main.

@jensmaurer
Copy link
Member

I like the radical suggestion:

Otherwise, if the type contains a placeholder type, it is replaced by the type
determined by placeholder type deduction\iref{dcl.type.auto.deduct}.

And then move the "shall" up to dcl.type.auto.deduct:

For an explicit type conversion, T is the specified type, which shall be auto.

@tkoeppe, this is now your branch/diff, so I can't do much here.

@tkoeppe tkoeppe removed the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Oct 20, 2021
@tkoeppe
Copy link
Contributor Author

tkoeppe commented Oct 20, 2021

@jensmaurer: you can bring your sense of Core aesthetics to bear on reviewing Mr Smith's idea :-)

Copy link
Member

@jensmaurer jensmaurer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

source/declarations.tex Outdated Show resolved Hide resolved
source/expressions.tex Outdated Show resolved Hide resolved
Comment on lines +1966 to +1964
If the initializer is a parenthesized \grammarterm{expression-list},
the \grammarterm{expression-list} shall be
a single \grammarterm{assignment-expression}
and $E$ is the \grammarterm{assignment-expression}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's weird to say this explicitly for auto(4) but not for auto x(4);, since the latter's initializer is (4). It's preexisting, but should we adjust /2.2 (or even try to combine them)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But... we say that in p2.2.3:

If the initializer is a parenthesized expression-list, the expression-list shall be a single assignment-expression and E is the assignment-expression

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say let's leave this for now? I'm not sure what exactly we could improve here.

source/declarations.tex Outdated Show resolved Hide resolved
@jensmaurer jensmaurer added this to the post-2021-10 milestone Oct 21, 2021
…' deduction

This change moves the fact that 'the type shall be auto' from
[expr.type.conv] to [dcl.type.auto.deduct], and thus avoids repeating
the mechanism of placeholder deduction.
@tkoeppe tkoeppe merged commit cb39ab5 into cplusplus:main Oct 21, 2021
@tkoeppe tkoeppe deleted the autodeduct branch October 21, 2021 10:46
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 this pull request may close these issues.

[expr.type.conv] Awkward invented declaration in P0849
5 participants