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.unary.op]/3: the value of a pointer should be "pointer to", not "address of" #2645

Closed
languagelawyer opened this issue Jan 9, 2019 · 2 comments · Fixed by #2918
Closed
Assignees

Comments

@languagelawyer
Copy link
Contributor

languagelawyer commented Jan 9, 2019

http://eel.is/c++draft/expr.unary.op#3.sentence-4:

Otherwise, if the type of the expression is T, the result has type “pointer to T” and is a prvalue that is the address of the designated object ([intro.memory]) or a pointer to the designated function.

  1. «The result of a prvalue is the value that the expression stores into its context.» ([basic.lval]). The lvalue can be of type T, but denote an object of type U, so the type of the result of applying the address-of operator to it will be pointer to U, not pointer to T (and I'm unsure if we even can talk about the type of the result. The result is "pointer to object", the type of the prvalue is pointer to T, but I don't think this makes sense to say that the type of the result is pointer to U). pointer to T is the type of the prvalue, not its result.
  2. the prvalue has the value "pointer to the designated object or function", not "the address of the designated object or a pointer to the designated function."

The note following the sentence above (http://eel.is/c++draft/expr.unary.op#3.note-1) also needs a fix:

In particular, the address of an object of type “cv T” is “pointer to cv T”

I don't think that addresses have types.

@jensmaurer
Copy link
Member

jensmaurer commented May 28, 2019

I don't follow item 1, but I think item 2 and the note could use some embellishment to properly fit into the pointer value framework of [basic.compound].

Suggestion: "Otherwise, if the type of the expression is T, the result is a prvalue of type "pointer to T" whose value is a pointer to the designated object [intro.memory] or function. [ Note: In particular, taking the address of a variable of type "cv T" yields a pointer of type "pointer to cv T". ]"

@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label May 28, 2019
@jensmaurer jensmaurer removed the decision-required A decision of the editorial group (or the Project Editor) is required. label Jun 5, 2019
@jensmaurer
Copy link
Member

Editorial meeting: Point 1 is wrong; for the rest, my suggestion is good.

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