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

2024-04-18


879. Missing built-in comparison operators for pointer types

Section: 12.5  [over.built]     Status: CD2     Submitter: Daniel Krügler     Date: 25 April, 2009

[Voted into WP at October, 2009 meeting.]

12.5 [over.built] paragraph 15 restricts the built-in comparison operators to

every T, where T is an enumeration type or pointer to effective object type

This omits both pointers to function types and pointers to void.

Proposed resolution (July, 2009):

  1. Add a new paragraph following 7.6.9 [expr.rel] paragraph 2:

  2. Pointers to void (after pointer conversions) can be compared, with a result defined as follows: If both pointers represent the same address or are both the null pointer value, the result is true if the operator is <= or >= and false otherwise; otherwise the result is unspecified.
  3. Change 7.6.10 [expr.eq] paragraph 1 as follows:

  4. ...Pointers to objects or functions of the same type (after pointer conversions) can be compared for equality...
  5. Change 12.5 [over.built] paragraph 15 as follows:

  6. For every T, where T is an enumeration type or, a pointer to effective object type, or std::nullptr_t, there exist candidate operator functions of the form...