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
Conversation
fa0f838
to
5195041
Compare
@opensdh, please have a look. |
Why me in this case? |
Because you wanted it: #4745 |
Thanks for the reminder! |
5195041
to
c782a12
Compare
c782a12
to
612d068
Compare
source/declarations.tex
Outdated
@@ -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}. |
There was a problem hiding this comment.
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 isauto
. --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.
There was a problem hiding this comment.
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.
source/expressions.tex
Outdated
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}. |
There was a problem hiding this comment.
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 beauto
.
There was a problem hiding this comment.
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).
612d068
to
4e228b7
Compare
Fixes #4979
Fixes cplusplus/papers#293