Skip to content

[expr.unary.op]/3: the value of a pointer should be "pointer to", not "address of" #2645

@languagelawyer

Description

@languagelawyer

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions