Skip to content

Commit

Permalink
[std] Rephrase notes containing 'must'
Browse files Browse the repository at this point in the history
Fixes ISO/CS 037 (C++23 DIS).
  • Loading branch information
jensmaurer committed Dec 17, 2023
1 parent c28d8ac commit 27d9812
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
12 changes: 6 additions & 6 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,8 @@
\end{example}
\begin{note}
The rules for declarations and expressions
describe in which contexts complete class types are required. A class
type \tcode{T} must be complete if:
describe in which contexts complete class types are required.
The program is ill-formed unless a class type \tcode{T} is be complete if:
\begin{itemize}
\item an object of type \tcode{T} is defined\iref{basic.def}, or
\item a non-static class data member of type \tcode{T} is
Expand Down Expand Up @@ -4207,10 +4207,10 @@
struct D : virtual B { char c; };
\end{codeblock}

When \tcode{D} is the type of a complete object, it will have a subobject of
type \tcode{B}, so it must be aligned appropriately for a \tcode{\keyword{long} \keyword{double}}.
When \tcode{D} is the type of a complete object, it has a subobject of
type \tcode{B}, so it is aligned appropriately for a \tcode{\keyword{long} \keyword{double}}.
If \tcode{D} appears as a subobject of another object that also has \tcode{B}
as a virtual base class, the \tcode{B} subobject might be part of a different
as a virtual base class, the \tcode{B} subobject can be part of a different
subobject, reducing the alignment requirements on the \tcode{D} subobject.
\end{example}
The result of the \keyword{alignof} operator reflects the alignment
Expand Down Expand Up @@ -6368,7 +6368,7 @@
\begin{note}
The value observed by a load of an atomic depends on the ``happens
before'' relation, which depends on the values observed by loads of atomics.
The intended reading is that there must exist an
The intended reading is that there exists an
association of atomic loads with modifications they observe that, together with
suitably chosen modification orders and the ``happens before'' relation derived
as described above, satisfy the resulting constraints as imposed here.
Expand Down
33 changes: 19 additions & 14 deletions source/expressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
required by the type; the types are not changed\
thereby.
\begin{footnote}
The cast and assignment operators must still perform their specific
The cast and assignment operators still perform their specific
conversions as described in~\ref{expr.type.conv}, \ref{expr.cast},
\ref{expr.static.cast} and~\ref{expr.ass}.
\end{footnote}
Expand Down Expand Up @@ -479,7 +479,8 @@
if the (possibly converted) expression is a prvalue of object type.
\begin{note}
If the original expression is an lvalue of class type,
it must have a volatile copy constructor to initialize the temporary object
the program is ill-formed unless
the class has a volatile copy constructor to initialize the temporary object
that is the result object of the temporary materialization conversion.
\end{note}
The expression is evaluated and its result (if any) is discarded.
Expand Down Expand Up @@ -716,7 +717,8 @@
\tcode{T} shall be a complete type.
\begin{note}
If \tcode{T} is a class type (or array thereof),
it must have an accessible and non-deleted destructor;
the program is ill-formed
unless the class has an accessible and non-deleted destructor;
see~\ref{class.dtor}.
\end{note}
\begin{example}
Expand Down Expand Up @@ -2389,7 +2391,7 @@
\end{itemize}
\begin{note}
This enables an \grammarterm{init-capture} like
``\tcode{x = std::move(x)}''; the second ``\tcode{x}'' must bind to a
``\tcode{x = std::move(x)}''; the second ``\tcode{x}'' binds to a
declaration in the surrounding context.
\end{note}
\begin{example}
Expand Down Expand Up @@ -2628,7 +2630,7 @@
If declared, such non-static data members shall be of literal type.
\begin{example}
\begin{codeblock}
// The inner closure type must be a literal type regardless of how reference captures are represented.
// The inner closure type is a literal type regardless of how reference captures are represented.
static_assert([](int n) { return [&n] { return ++n; }(); }(3) == 4);
\end{codeblock}
\end{example}
Expand Down Expand Up @@ -4205,9 +4207,10 @@
containing the original member, the resulting pointer to member points
to the original member. Otherwise, the behavior is undefined.
\begin{note}
Although class \tcode{B} need not contain the original member, the
dynamic type of the object with which indirection through the pointer
to member is performed must contain the original member;
Although class \tcode{B} need not contain the original member,
the behavior is undefined
if the dynamic type of the object with which indirection through the pointer
to member is performed does not contain the original member;
see~\ref{expr.mptr.oper}.
\end{note}

Expand Down Expand Up @@ -4591,8 +4594,9 @@
\indextext{type!incomplete}%
Indirection through a pointer to an incomplete type (other than
\cv{} \keyword{void}) is valid. The lvalue thus obtained can be
used in limited ways (to initialize a reference, for example); this
lvalue must not be converted to a prvalue, see~\ref{conv.lval}.
used in limited ways (to initialize a reference, for example);
the program is ill-formed
if such an lvalue is converted to a prvalue, see~\ref{conv.lval}.
\end{note}

\pnum
Expand Down Expand Up @@ -5593,7 +5597,7 @@

\pnum
\begin{note}
When the allocation function returns a value other than null, it must be
When the allocation function returns a value other than null, it returns
a pointer to a block of storage in which space for the object has been
reserved. The block of storage is assumed to be
appropriately aligned\iref{basic.align}
Expand Down Expand Up @@ -5778,9 +5782,10 @@
\end{footnote}
If not, the behavior is undefined.
\begin{note}
This means that the syntax of the \grammarterm{delete-expression} must
match the type of the object allocated by \keyword{new}, not the syntax of the
\grammarterm{new-expression}.
This means that the behavior is undefined
if the syntax of the \grammarterm{delete-expression} does not
match the type of the object allocated by \keyword{new},
regardless of the syntax of the \grammarterm{new-expression}.
\end{note}
\begin{note}
A pointer to a \keyword{const} type can be the operand of a
Expand Down

0 comments on commit 27d9812

Please sign in to comment.