Skip to content

[expr.spaceship] Clarify treatment of pointers. #3958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions source/expressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5955,8 +5955,8 @@
and applying \tcode{<=>} to the converted operands.

\pnum
If at least one of the operands is of pointer type and
the other operand is of pointer or array type,
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\iref{conv.array},
pointer conversions\iref{conv.ptr},
and
Expand All @@ -5968,20 +5968,24 @@
If both of the operands are arrays,
array-to-pointer conversions\iref{conv.array} are not applied.
\end{note}

\pnum
If the composite pointer type is an object pointer type,
\tcode{p <=> q} is of type \tcode{std::strong_ordering}.
In this case,
\tcode{p <=> q} is of type \tcode{std::strong_ordering} and
the result is defined by the following rules:
\begin{itemize}
\item
If two pointer operands \tcode{p} and \tcode{q} compare equal\iref{expr.eq},
\tcode{p <=> q} yields \tcode{std::strong_ordering::equal};
if \tcode{p} and \tcode{q} compare unequal,
\item
otherwise, if \tcode{p} and \tcode{q} compare unequal,
\tcode{p <=> q} yields
\tcode{std::strong_ordering::less}
if \tcode{q} compares greater than \tcode{p}
and
\tcode{std::strong_ordering::greater}
if \tcode{p} compares greater than \tcode{q}\iref{expr.rel}.
Otherwise, the result is unspecified.
if \tcode{p} compares greater than \tcode{q}\iref{expr.rel};
\item
otherwise, the result is unspecified.
\end{itemize}

\pnum
Otherwise, the program is ill-formed.
Expand Down