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

P0849R8 auto(x): decay-copy in the language #5015

Merged
merged 1 commit into from Oct 19, 2021
Merged

Conversation

jensmaurer
Copy link
Member

@jensmaurer jensmaurer commented Oct 8, 2021

@jensmaurer jensmaurer added this to the post-2021-10 milestone Oct 8, 2021
source/expressions.tex Show resolved Hide resolved
@jensmaurer jensmaurer added the changes requested Changes to the wording or approach have been requested and not yet applied. label Oct 14, 2021
@jensmaurer jensmaurer removed the changes requested Changes to the wording or approach have been requested and not yet applied. label Oct 15, 2021
@jensmaurer
Copy link
Member Author

@opensdh, please have a look.

@opensdh
Copy link
Contributor

opensdh commented Oct 15, 2021

Why me in this case?

@jensmaurer
Copy link
Member Author

Why me in this case?

Because you wanted it: #4745

@opensdh
Copy link
Contributor

opensdh commented Oct 15, 2021

Thanks for the reminder!

@jensmaurer jensmaurer added the changes requested Changes to the wording or approach have been requested and not yet applied. label Oct 16, 2021
source/declarations.tex Show resolved Hide resolved
@jensmaurer jensmaurer removed the changes requested Changes to the wording or approach have been requested and not yet applied. label Oct 18, 2021
@jensmaurer
Copy link
Member Author

@opensdh, could you please have a look at the clean-up patch implementing your suggestion from #4745? Thanks.

@@ -1954,6 +1954,20 @@
that contains a placeholder type,
\tcode{T} is the declared type of the non-type template parameter
and $E$ is the corresponding template argument.
\item
For an explicit type conversion\iref{expr.type.conv},
\tcode{T} is \tcode{auto}.
Copy link
Contributor

Choose a reason for hiding this comment

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

So as to not just say "T is auto" without any hint why, @zygoloid suggests something like this:

[...] T is the specified type. [Note: Placeholder type deduction is only performed when the specified type is auto. --end note]

It's a bit more verbose, but helps the reader along a little. What do you think, @opensdh, @jensmaurer ?

Alternatively, for an even more radical change, see second comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Moving discussion to separate pull request #5039.

Comment on lines 3356 to 3358
Otherwise, if the type is \tcode{auto},
it is replaced by the type deduced for the variable \tcode{x}
in the invented declaration\iref{dcl.spec.auto},
which is never interpreted as a function declaration:
\begin{codeblock}
auto x @\placeholder{init}@;
\end{codeblock}
, where \placeholder{init} is the initializer.
it is replaced by the type
determined by placeholder type deduction\iref{dcl.type.auto.deduct}.
Copy link
Contributor

Choose a reason for hiding this comment

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

Even more radical alternative:

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with this direction (as implemented in #5039).

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.

[2021-10 LWG Motion 8] P0849R8 auto(x): decay-copy in the language P0849 auto(x): DECAY_COPY in the language
6 participants