CWG Issue 879 (original) (raw)

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

2025-04-13


879. Missing built-in comparison operators for pointer types

Section: 12.5 [over.built]Status: CD2Submitter: Daniel KrüglerDate: 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: 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 istrue if the operator is <= or >= andfalse otherwise; otherwise the result is unspecified.
  2. Change 7.6.10 [expr.eq] paragraph 1 as follows:

...Pointers to objects or functions of the same type (after pointer conversions) can be compared for equality...

  1. Change 12.5 [over.built] paragraph 15 as follows: For every T, where T is an enumeration typeor, a pointer to effective object type,or std::nullptr_t, there exist candidate operator functions of the form...