This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 108f. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2022-06-09


342. Terminology: "indirection" versus "dereference"

Section: 7.6.2  [expr.unary]     Status: CD3     Submitter: Jason Merrill     Date: 7 Oct 2001

[Moved to DR at the October, 2012 meeting.]

Split off from issue 315.

Incidentally, another thing that ought to be cleaned up is the inconsistent use of "indirection" and "dereference". We should pick one.

Proposed resolution (December, 2006):

  1. Change 7.6.2.2 [expr.unary.op] paragraph 1 as follows:

  2. The unary * operator performs indirection dereferences a pointer value: the expression to which it is applied shall be a pointer...
  3. Change 9.3.4.5 [term.array.type] paragraph 8 as follows:

  4. The results are added and indirection applied values are added and the result is dereferenced to yield an array (of five integers), which in turn is converted to a pointer to the first of the integers.
  5. Change 9.3.4.6 [dcl.fct] paragraph 9 as follows:

  6. The binding of *fpi(int) is *(fpi(int)), so the declaration suggests, and the same construction in an expression requires, the calling of a function fpi, and then using indirection through dereferencing the (pointer) result to yield an integer. In the declarator (*pif)(const char*, const char*), the extra parentheses are necessary to indicate that indirection through dereferencing a pointer to a function yields a function, which is then called.
  7. Change the index for * and “dereferencing” no longer to refer to “indirection.”

[Drafting note: 28.6.9 [template.indirect.array] requires no change. Many more places in the current wording use “dereferencing” than “indirection.”]

Notes from the August, 2011 meeting:

CWG prefers use of the term “indirection” instead of “dereferencing.” This would be consistent with the usage in the C Standard and would avoid entanglement with the C++ concept of a reference type.

Proposed resolution (February, 2012):

  1. Change 6.7.5.5.2 [basic.stc.dynamic.allocation] paragraph 2 as follows:

  2. ...The effect of dereferencing indirecting through a pointer returned as a request for zero size is undefined.
  3. Change _N4885_6.7.5.5.4 [basic.stc.dynamic.safety] paragraph 2 as follows:

  4. Change 6.7.3 [basic.life] paragraph 5 as follows:

  5. ...Such Indirection through such a pointer may be dereferenced is permitted but the resulting lvalue may only be used in limited ways...
  6. Change 7.3.13 [conv.mem] paragraph 2 as follows:

  7. ...Since the result has type “pointer to member of D of type cv T”, it can be dereferenced indirection through it with a D object is valid. The result is the same as if indirecting through the pointer to member of B were dereferenced with the B subobject of D. The null member pointer value...
  8. Change 7.6.1.9 [expr.static.cast] paragraph 12 as follows:

  9. ...[Note: although class B need not contain the original member, the dynamic type of the object on with which indirection through the pointer to member is dereferenced performed must contain the original member; see 7.6.4 [expr.mptr.oper]. —end note]
  10. Change 7.6.2.2 [expr.unary.op] paragraph 1 as follows:

  11. ...[Note: indirection through a pointer to an incomplete type (other than cv void) can be dereferenced is valid. The lvalue thus obtained...
  12. Change 7.6.10 [expr.eq] paragraph 2 as follows:

  13. ...Otherwise they compare equal if and only if they would refer to the same member of the same most derived object (6.7.2 [intro.object]) or the same subobject if they were dereferenced indirection with a hypothetical object of the associated class type were performed. [Example:...
  14. Change 9.11 [dcl.link] paragraph 8:

  15. [Note: Because the language linkage is part of a function type, when indirecting through a pointer to C function (for example) is dereferenced, the function to which it the resulting lvalue refers is considered a C function. —end note]
  16. Change 9.3.4.3 [dcl.ref] paragraph 5 as follows:

  17. ...[Note: in particular, a null reference cannot exist in a well-defined program, because the only way to create such a reference would be to bind it to the “object” obtained by dereferencing indirection through a null pointer, which causes undefined behavior. As described...
  18. Change 16.4.4.6 [allocator.requirements] table 27:

  19. Variable Definition
    ...
    c a dereferenceable pointer of type C* through which indirection is valid
    ...
  20. Change 20.2.3.3 [pointer.traits.functions] as follows:

  21. Returns: The first member function returns a dereferenceable pointer to r obtained by calling Ptr::pointer_to(r) through which indirection is valid; an instantiation of this function is ill-formed...
  22. Change _N4885_.20.10.5 [util.dynamic.safety] paragraph 10 as follows:

  23. Effects: The n bytes starting at p no longer contain traceable pointer locations, independent of their type. Hence pointers indirection through a pointer located there may not be dereferenced is undefined if the object they point it points to was created by global operator new and not previously declared reachable...
  24. Change 27.11 [specialized.algorithms] paragraph 1 as follows:

  25. ...is required to have the property that no exceptions are thrown from increment, assignment, comparison, or dereference of indirection through valid iterators...
  26. Change 30.4.6.2.3 [locale.time.get.virtuals] paragraph 11 as follows:

  27. Requires: t shall be dereferenceable point to an object.
  28. Change 24.4.4.2 [map.cons] paragraph 3 as follows:

  29. Requires: If the iterator's dereference indirection operator returns an lvalue or a const rvalue pair<key_type, mapped_type>, then both key_type and mapped_type shall be CopyConstructible.
  30. Change 24.4.5.2 [multimap.cons] paragraph 3 as follows:

  31. Requires: If the iterator's dereference indirection operator returns an lvalue or a const rvalue pair<key_type, mapped_type>, then both key_type and mapped_type shall be CopyConstructible.
  32. Change 24.4.6.2 [set.cons] paragraph 4 as follows:

  33. Requires: If the iterator's dereference indirection operator returns an lvalue or a non-const rvalue, then Key shall be CopyConstructible.
  34. Change 24.4.7.2 [multiset.cons] paragraph 3 as follows:

  35. Requires: If the iterator's dereference indirection operator returns an lvalue or a const rvalue, then Key shall be CopyConstructible.
  36. Change 25.5.3 [move.iterators] paragraph 1 as follows:

  37. Class template move_iterator is an iterator adaptor with the same behavior as the underlying iterator except that its dereference indirection operator implicitly converts the value returned by the underlying iterator's dereference indirection operator to an rvalue reference...
  38. Change the title of 32.11.1.4 [re.regiter.deref] as follows:

  39. regex_iterator dereference indirection
  40. Change the title of 32.11.2.4 [re.tokiter.deref] as follows:

  41. regex_token_iterator dereference indirection