Skip to content

Commit a554a1a

Browse files
committed
[std] Rephrase notes containing 'must'
Fixes ISO/CS 037 (C++23 DIS).
1 parent 6388ea5 commit a554a1a

File tree

7 files changed

+71
-58
lines changed

7 files changed

+71
-58
lines changed

source/basic.tex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,8 @@
585585
\end{example}
586586
\begin{note}
587587
The rules for declarations and expressions
588-
describe in which contexts complete class types are required. A class
589-
type \tcode{T} must be complete if:
588+
describe in which contexts complete class types are required.
589+
The program is ill-formed unless a class type \tcode{T} is complete if:
590590
\begin{itemize}
591591
\item an object of type \tcode{T} is defined\iref{basic.def}, or
592592
\item a non-static class data member of type \tcode{T} is
@@ -4207,10 +4207,10 @@
42074207
struct D : virtual B { char c; };
42084208
\end{codeblock}
42094209

4210-
When \tcode{D} is the type of a complete object, it will have a subobject of
4211-
type \tcode{B}, so it must be aligned appropriately for a \tcode{\keyword{long} \keyword{double}}.
4210+
When \tcode{D} is the type of a complete object, it has a subobject of
4211+
type \tcode{B}, so it is aligned appropriately for a \tcode{\keyword{long} \keyword{double}}.
42124212
If \tcode{D} appears as a subobject of another object that also has \tcode{B}
4213-
as a virtual base class, the \tcode{B} subobject might be part of a different
4213+
as a virtual base class, the \tcode{B} subobject can be part of a different
42144214
subobject, reducing the alignment requirements on the \tcode{D} subobject.
42154215
\end{example}
42164216
The result of the \keyword{alignof} operator reflects the alignment
@@ -6368,7 +6368,7 @@
63686368
\begin{note}
63696369
The value observed by a load of an atomic depends on the ``happens
63706370
before'' relation, which depends on the values observed by loads of atomics.
6371-
The intended reading is that there must exist an
6371+
The intended reading is that there exists an
63726372
association of atomic loads with modifications they observe that, together with
63736373
suitably chosen modification orders and the ``happens before'' relation derived
63746374
as described above, satisfy the resulting constraints as imposed here.

source/classes.tex

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,10 @@
435435
class A * A;
436436
\end{codeblock}
437437
first specifies \tcode{A} to be the name of a class and then redefines
438-
it as the name of a pointer to an object of that class. This means that
439-
the elaborated form \keyword{class} \tcode{A} must be used to refer to the
440-
class. Such artistry with names can be confusing and is best avoided.
438+
it as the name of a pointer to an object of that class.
439+
This means references to the class are ill-formed
440+
unless the elaborated form \keyword{class} \tcode{A} is used.
441+
Such artistry with names can be confusing and is best avoided.
441442
\end{note}
442443

443444
\pnum
@@ -2226,7 +2227,7 @@
22262227
\end{codeblock}
22272228
\end{example}
22282229
\begin{note}
2229-
An explicit destructor call must always be written using
2230+
An explicit destructor call is always written using
22302231
a member access operator\iref{expr.ref} or a \grammarterm{qualified-id}\iref{expr.prim.id.qual};
22312232
in particular, the
22322233
\grammarterm{unary-expression}
@@ -3107,9 +3108,10 @@
31073108
default constructor\iref{class.default.ctor},
31083109
copy constructor, move constructor\iref{class.copy.ctor},
31093110
copy assignment operator, move assignment operator\iref{class.copy.assign},
3110-
or destructor\iref{class.dtor}, the corresponding member function
3111-
of the union must be user-provided or it will
3112-
be implicitly deleted\iref{dcl.fct.def.delete} for the union.
3111+
or destructor\iref{class.dtor},
3112+
the corresponding member function of the union
3113+
will be implicitly deleted\iref{dcl.fct.def.delete}
3114+
unless it is user-provided.
31133115
\begin{example}
31143116
Consider the following union:
31153117
\begin{codeblock}
@@ -3123,8 +3125,8 @@
31233125
member functions, \tcode{U} will have an implicitly deleted default constructor,
31243126
copy/move constructor,
31253127
copy/move assignment operator, and destructor.
3126-
To use \tcode{U}, some or all of these member functions
3127-
must be user-provided.
3128+
A use \tcode{U} is ill-formed
3129+
unless some or all of these member functions are user-provided.
31283130
\end{example}
31293131
\end{note}
31303132

@@ -4159,8 +4161,9 @@
41594161
void draw(); // a definition is required somewhere
41604162
};
41614163
\end{codeblock}
4162-
would make class \tcode{circle} non-abstract and a definition of
4163-
\tcode{circle::draw()} must be provided.
4164+
would make class \tcode{circle} non-abstract;
4165+
the program is ill-formed, no diagnostic required,
4166+
unless a definition of \tcode{circle::draw()} is provided\iref{basic.def.odr}.
41644167
\end{example}
41654168

41664169
\pnum
@@ -4349,14 +4352,14 @@
43494352
\tcode{A}.
43504353
This implies, for example, that access checking on the first use of
43514354
\tcode{A::I}
4352-
must be deferred until it is determined that this use of
4355+
is deferred until it is determined that this use of
43534356
\tcode{A::I}
43544357
is as the return type of a member of class
43554358
\tcode{A}.
43564359
Similarly, the use of \tcode{A::B} as a
43574360
\grammarterm{base-specifier} is well-formed because \tcode{D}
43584361
is derived from \tcode{A}, so checking of \grammarterm{base-specifier}{s}
4359-
must be deferred until the entire \grammarterm{base-specifier-list} has been seen.
4362+
is deferred until the entire \grammarterm{base-specifier-list} has been seen.
43604363
\end{example}
43614364

43624365
\pnum

source/declarations.tex

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@
332332

333333
void g(char c) {
334334
f(0); // OK
335-
f(c); // error on implementations where \tcode{sizeof(int) > 1}: must be \tcode{int}-sized
335+
f(c); // error on implementations where \tcode{sizeof(int) > 1}: \tcode{must be int-sized}
336336
}
337337
\end{codeblock}
338338
\end{example}
@@ -1196,10 +1196,11 @@
11961196
\pnum
11971197
\begin{note}
11981198
Declaring a variable \keyword{const} can affect its linkage\iref{dcl.stc}
1199-
and its usability in constant expressions\iref{expr.const}. As
1200-
described in~\ref{dcl.init}, the definition of an object or subobject
1201-
of const-qualified type must specify an initializer or be subject to
1202-
default-initialization.
1199+
and its usability in constant expressions\iref{expr.const}.
1200+
As described in~\ref{dcl.init},
1201+
the definition of an object or subobject of const-qualified type is ill-formed
1202+
unless the definition specifies an initializer or
1203+
be subject to default-initialization.
12031204
\end{note}
12041205

12051206
\pnum
@@ -3595,10 +3596,9 @@
35953596
printf("a=%d b=%d", a, b);
35963597
\end{codeblock}
35973598

3598-
However, the first argument must be of a type
3599-
that can be converted to a
3600-
\keyword{const}
3601-
\tcode{char*}.
3599+
However, the program is ill-formed
3600+
unless the first argument is of a type
3601+
that can be converted to a \keyword{const} \tcode{char*}.
36023602
\end{example}
36033603
\begin{note}
36043604
The standard header \libheaderref{cstdarg}
@@ -4963,7 +4963,7 @@
49634963
are the first $n$ elements of the aggregate,
49644964
where $n$ is the number of elements in the initializer list.
49654965
\item
4966-
Otherwise, the initializer list must be \tcode{\{\}},
4966+
Otherwise, the initializer list is \tcode{\{\}},
49674967
and there are no explicitly initialized elements.
49684968
\end{itemize}
49694969

source/expressions.tex

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
required by the type; the types are not changed\
130130
thereby.
131131
\begin{footnote}
132-
The cast and assignment operators must still perform their specific
132+
The cast and assignment operators still perform their specific
133133
conversions as described in~\ref{expr.type.conv}, \ref{expr.cast},
134134
\ref{expr.static.cast} and~\ref{expr.ass}.
135135
\end{footnote}
@@ -479,7 +479,8 @@
479479
if the (possibly converted) expression is a prvalue of object type.
480480
\begin{note}
481481
If the original expression is an lvalue of class type,
482-
it must have a volatile copy constructor to initialize the temporary object
482+
the program is ill-formed unless
483+
the class has a volatile copy constructor to initialize the temporary object
483484
that is the result object of the temporary materialization conversion.
484485
\end{note}
485486
The expression is evaluated and its result (if any) is discarded.
@@ -716,7 +717,8 @@
716717
\tcode{T} shall be a complete type.
717718
\begin{note}
718719
If \tcode{T} is a class type (or array thereof),
719-
it must have an accessible and non-deleted destructor;
720+
the program is ill-formed
721+
unless the class has an accessible and non-deleted destructor;
720722
see~\ref{class.dtor}.
721723
\end{note}
722724
\begin{example}
@@ -2389,7 +2391,7 @@
23892391
\end{itemize}
23902392
\begin{note}
23912393
This enables an \grammarterm{init-capture} like
2392-
``\tcode{x = std::move(x)}''; the second ``\tcode{x}'' must bind to a
2394+
``\tcode{x = std::move(x)}''; the second ``\tcode{x}'' binds to a
23932395
declaration in the surrounding context.
23942396
\end{note}
23952397
\begin{example}
@@ -2628,7 +2630,7 @@
26282630
If declared, such non-static data members shall be of literal type.
26292631
\begin{example}
26302632
\begin{codeblock}
2631-
// The inner closure type must be a literal type regardless of how reference captures are represented.
2633+
// The inner closure type is a literal type regardless of how reference captures are represented.
26322634
static_assert([](int n) { return [&n] { return ++n; }(); }(3) == 4);
26332635
\end{codeblock}
26342636
\end{example}
@@ -4205,9 +4207,10 @@
42054207
containing the original member, the resulting pointer to member points
42064208
to the original member. Otherwise, the behavior is undefined.
42074209
\begin{note}
4208-
Although class \tcode{B} need not contain the original member, the
4209-
dynamic type of the object with which indirection through the pointer
4210-
to member is performed must contain the original member;
4210+
Although class \tcode{B} need not contain the original member,
4211+
the behavior is undefined
4212+
if the dynamic type of the object with which indirection through the pointer
4213+
to member is performed does not contain the original member;
42114214
see~\ref{expr.mptr.oper}.
42124215
\end{note}
42134216

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

45984602
\pnum
@@ -5593,7 +5597,7 @@
55935597

55945598
\pnum
55955599
\begin{note}
5596-
When the allocation function returns a value other than null, it must be
5600+
When the allocation function returns a value other than null, it returns
55975601
a pointer to a block of storage in which space for the object has been
55985602
reserved. The block of storage is assumed to be
55995603
appropriately aligned\iref{basic.align}
@@ -5778,9 +5782,10 @@
57785782
\end{footnote}
57795783
If not, the behavior is undefined.
57805784
\begin{note}
5781-
This means that the syntax of the \grammarterm{delete-expression} must
5782-
match the type of the object allocated by \keyword{new}, not the syntax of the
5783-
\grammarterm{new-expression}.
5785+
This means that the behavior is undefined
5786+
if the syntax of the \grammarterm{delete-expression} does not
5787+
match the type of the object allocated by \keyword{new},
5788+
regardless of the syntax of the \grammarterm{new-expression}.
57845789
\end{note}
57855790
\begin{note}
57865791
A pointer to a \keyword{const} type can be the operand of a
@@ -7947,8 +7952,8 @@
79477952
\begin{example}
79487953
\begin{codeblock}
79497954
bool f() {
7950-
char array[1 + int(1 + 0.2 - 0.1 - 0.1)]; // Must be evaluated during translation
7951-
int size = 1 + int(1 + 0.2 - 0.1 - 0.1); // May be evaluated at runtime
7955+
char array[1 + int(1 + 0.2 - 0.1 - 0.1)]; // Evaluated during translation
7956+
int size = 1 + int(1 + 0.2 - 0.1 - 0.1); // Can be evaluated at runtime
79527957
return sizeof(array) == size;
79537958
}
79547959
\end{codeblock}

source/modules.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@
824824

825825
\item
826826
where definitions for inline functions and templates
827-
must appear\iref{basic.def.odr,dcl.inline,temp.pre},
827+
are required to appear\iref{basic.def.odr,dcl.inline,temp.pre},
828828

829829
\item
830830
the instantiation contexts of templates

source/overloading.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
\indextext{function!overloaded|see{overloading}}%
1212
\begin{note}
1313
Each of two or more entities with the same name in the same scope,
14-
which must be functions or function templates,
14+
which are necessarily functions or function templates,
1515
is commonly called an ``overload''.
1616
\end{note}
1717

@@ -1379,7 +1379,7 @@
13791379
\pnum
13801380
When resolving a placeholder for a deduced class type\iref{dcl.type.simple}
13811381
where the \grammarterm{template-name} names an alias template \tcode{A},
1382-
the \grammarterm{defining-type-id} of \tcode{A} must be of the form
1382+
the \grammarterm{defining-type-id} of \tcode{A} is required to be of the form
13831383
\begin{ncsimplebnf}
13841384
\opt{\keyword{typename}} \opt{nested-name-specifier} \opt{\keyword{template}} simple-template-id
13851385
\end{ncsimplebnf}

source/templates.tex

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@
138138
\begin{note}
139139
Default arguments for function templates and for member functions of
140140
class templates are considered definitions for the purpose of template
141-
instantiation\iref{temp.decls} and must obey the one-definition rule\iref{basic.def.odr}.
141+
instantiation\iref{temp.decls} and
142+
thus are covered by the one-definition rule\iref{basic.def.odr}.
142143
\end{note}
143144

144145
\pnum
@@ -2471,7 +2472,8 @@
24712472
A member class of a class template may be defined outside the class template
24722473
definition in which it is declared.
24732474
\begin{note}
2474-
The member class must be defined before its first use that requires
2475+
The program is ill-formed
2476+
if the member class is not defined before its first use that requires
24752477
an instantiation\iref{temp.inst}.
24762478
For example,
24772479
\begin{codeblock}
@@ -3621,8 +3623,11 @@
36213623
overload resolution of
36223624
function template specializations
36233625
with the same name.
3624-
If such a non-template function is odr-used\iref{term.odr.use} in a program, it must be defined;
3625-
it will not be implicitly instantiated using the function template definition.
3626+
A program is ill-formed
3627+
if such a non-template function is odr-used\iref{term.odr.use} in a program
3628+
and there is no definition;
3629+
the definition will not be implicitly instantiated
3630+
using the function template definition.
36263631
\end{footnote}
36273632

36283633
\rSec3[temp.over.link]{Function template overloading}
@@ -6577,7 +6582,7 @@
65776582

65786583
void h() {
65796584
A<int> a;
6580-
a.f(16); // \tcode{A<int>::f} must be defined somewhere
6585+
a.f(16); // error: \tcode{A<int>::f} is not defined
65816586
}
65826587

65836588
// \tcode{\keyword{template}<>} not used for a member of an explicitly specialized class template
@@ -7755,9 +7760,9 @@
77557760
is not used in any of the function parameters of a function template,
77567761
or is used only in a non-deduced context, its corresponding
77577762
\grammarterm{template-argument}
7758-
cannot be deduced from a function call and the
7759-
\grammarterm{template-argument}
7760-
must be explicitly specified.
7763+
cannot be deduced from a function call, and
7764+
thus the program is ill-formed
7765+
unless the \grammarterm{template-argument} is explicitly specified.
77617766
\end{note}
77627767

77637768
\pnum
@@ -8695,8 +8700,8 @@
86958700
B<77> b;
86968701

86978702
int x = deduce<77>(a.xm, 62, b.ym);
8698-
// \tcode{T} deduced as \tcode{int}; \tcode{a.xm} must be convertible to \tcode{A<int>::X}
8699-
// \tcode{i} is explicitly specified to be \tcode{77}; \tcode{b.ym} must be convertible to \tcode{B<77>::Y}
8703+
// \tcode{T} deduced as \tcode{int}; \tcode{a.xm} is required to be convertible to \tcode{A<int>::X}
8704+
// \tcode{i} is explicitly specified to be \tcode{77}; \tcode{b.ym} is required to be convertible to \tcode{B<77>::Y}
87008705
\end{codeblock}
87018706
\end{note}
87028707

0 commit comments

Comments
 (0)