You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[expr.spaceship] p7+8 use a convoluted and partially misleading way to exclude function pointers from three-way comparison:
7 If the composite pointer type is an object pointer type, p <=> q is of type std::strong_ordering. If
two pointer operands p and q compare equal (7.6.10), p <=> q yields std::strong_ordering::equal; if p
and q compare unequal, p <=> q yields std::strong_ordering::less if q compares greater than p and
std::strong_ordering::greater if p compares greater than q (7.6.9). Otherwise, the result is unspecified.
8 Otherwise, the program is ill-formed.
The first problem is that to me the "arm-length" of the first if in p7's first sentence is unclear and the second problem is that the end of p7 and the start of p8 are confusing. My initial reading lead to the understanding that the first p7 sentence is a very special sentence about object pointers and the following ones of that paragraph would apply to potentially other pointers as well.
I would therefore suggest to follow the style used in [expr.rel] p4 and reformulate p7 by converting it into a bullet list as follows:
7 If the composite pointer type is an object pointer type, p <=> q is of type std::strong_ordering and the result is defined in terms of the following rules:.
If two pointer operands p and q compare equal (7.6.10), p <=> q yields std::strong_ordering::equal;
otherwise, if p and q compare unequal, p <=> q yields std::strong_ordering::less if q compares greater than p and std::strong_ordering::greater if p compares greater than q (7.6.9).
Otherwise, the result is unspecified.
8 Otherwise, the program is ill-formed.
During a corresponding discussion with Richard on the CWG reflector he generally agreed with the suggested change direction and he suggested to additionally improve the previous p6 wording as well as follows:
6 If at least one of the operands is of object pointer type and the other operand is of object pointer or array type, array-to pointer conversions (7.3.2), pointer conversions (7.3.11), and qualification conversions (7.3.5) are performed on both operands to bring them to their composite pointer type (7.2.2). [..]
The text was updated successfully, but these errors were encountered:
[expr.spaceship] p7+8 use a convoluted and partially misleading way to exclude function pointers from three-way comparison:
The first problem is that to me the "arm-length" of the first if in p7's first sentence is unclear and the second problem is that the end of p7 and the start of p8 are confusing. My initial reading lead to the understanding that the first p7 sentence is a very special sentence about object pointers and the following ones of that paragraph would apply to potentially other pointers as well.
I would therefore suggest to follow the style used in [expr.rel] p4 and reformulate p7 by converting it into a bullet list as follows:
7 If the composite pointer type is an object pointer type, p <=> q is of type std::strong_ordering and the result is defined in terms of the following rules:
.8 Otherwise, the program is ill-formed.
During a corresponding discussion with Richard on the CWG reflector he generally agreed with the suggested change direction and he suggested to additionally improve the previous p6 wording as well as follows:
6 If at least one of the operands is of object pointer type and the other operand is of object pointer or array type, array-to pointer conversions (7.3.2), pointer conversions (7.3.11), and qualification conversions (7.3.5) are performed on both operands to bring them to their composite pointer type (7.2.2). [..]
The text was updated successfully, but these errors were encountered: