Skip to content

Commit e027653

Browse files
jensmaurertkoeppe
authored andcommitted
[std] Use \keyword for 'auto'.
1 parent 52301eb commit e027653

File tree

6 files changed

+31
-31
lines changed

6 files changed

+31
-31
lines changed

source/classes.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6346,11 +6346,11 @@
63466346

63476347
\begin{itemize}
63486348
\item
6349-
for an \tcode{operator<=>} whose return type is not \tcode{auto},
6349+
for an \tcode{operator<=>} whose return type is not \keyword{auto},
63506350
when determining whether a synthesized three-way comparison is defined,
63516351

63526352
\item
6353-
for an \tcode{operator<=>} whose return type is \tcode{auto} or
6353+
for an \tcode{operator<=>} whose return type is \keyword{auto} or
63546354
for an \tcode{operator==},
63556355
for a comparison between an element of the expanded list of
63566356
subobjects and itself, or
@@ -6528,7 +6528,7 @@
65286528

65296529
\begin{itemize}
65306530
\item
6531-
If \tcode{R} is \tcode{auto}, then
6531+
If \tcode{R} is \keyword{auto}, then
65326532
let $\cv{}_i~\tcode{R}_i$ be
65336533
the type of the expression $\tcode{x}_i\tcode{ <=> }\tcode{x}_i$.
65346534
The operator function is defined as deleted

source/compatibility.tex

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@
799799

800800
\diffref{dcl.spec.auto}
801801
\change
802-
\tcode{auto} deduction from \grammarterm{braced-init-list}.
802+
\keyword{auto} deduction from \grammarterm{braced-init-list}.
803803
\rationale
804804
More intuitive deduction behavior.
805805
\effect
@@ -1352,15 +1352,15 @@
13521352

13531353
\diffref{dcl.spec}
13541354
\change
1355-
Remove \tcode{auto} as a storage class specifier.
1355+
Remove \keyword{auto} as a storage class specifier.
13561356
\rationale
13571357
New feature.
13581358
\effect
1359-
Valid \CppIII{} code that uses the keyword \tcode{auto} as a storage class
1359+
Valid \CppIII{} code that uses the keyword \keyword{auto} as a storage class
13601360
specifier
13611361
may be invalid in this revision of \Cpp{}.
13621362
In this revision of \Cpp{},
1363-
\tcode{auto} indicates that the type of a variable is to be deduced
1363+
\keyword{auto} indicates that the type of a variable is to be deduced
13641364
from its initializer expression.
13651365

13661366
\diffref{dcl.init.list}
@@ -2270,7 +2270,7 @@
22702270

22712271
\diffref{dcl.spec.auto}
22722272
\change
2273-
The keyword \tcode{auto} cannot be used as a storage class specifier.
2273+
The keyword \keyword{auto} cannot be used as a storage class specifier.
22742274

22752275
\begin{codeblock}
22762276
void f() {
@@ -2279,9 +2279,9 @@
22792279
\end{codeblock}
22802280

22812281
\rationale
2282-
Allowing the use of \tcode{auto} to deduce the type
2282+
Allowing the use of \keyword{auto} to deduce the type
22832283
of a variable from its initializer results in undesired interpretations of
2284-
\tcode{auto} as a storage class specifier in certain contexts.
2284+
\keyword{auto} as a storage class specifier in certain contexts.
22852285
\effect
22862286
Deletion of semantically well-defined feature.
22872287
\difficulty

source/declarations.tex

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
a \defn{structured binding declaration}\iref{dcl.struct.bind}.
175175
If the \grammarterm{decl-specifier-seq} contains
176176
any \grammarterm{decl-specifier} other than
177-
\tcode{static}, \tcode{thread_local}, \tcode{auto}\iref{dcl.spec.auto}, or
177+
\tcode{static}, \tcode{thread_local}, \keyword{auto}\iref{dcl.spec.auto}, or
178178
\grammarterm{cv-qualifier}{s},
179179
the program is ill-formed.
180180
The \grammarterm{initializer} shall be
@@ -1666,12 +1666,12 @@
16661666

16671667
\pnum
16681668
A \grammarterm{placeholder-type-specifier} of the form
1669-
\opt{\grammarterm{type-constraint}} \tcode{auto}
1669+
\opt{\grammarterm{type-constraint}} \keyword{auto}
16701670
can be used as a \grammarterm{decl-specifier} of
16711671
the \grammarterm{decl-specifier-seq} of
16721672
a \grammarterm{parameter-declaration} of
16731673
a function declaration or \grammarterm{lambda-expression} and,
1674-
if it is not the \tcode{auto} \grammarterm{type-specifier}
1674+
if it is not the \keyword{auto} \grammarterm{type-specifier}
16751675
introducing a \grammarterm{trailing-return-type} (see below),
16761676
is a \defn{generic parameter type placeholder}
16771677
of the function declaration or \grammarterm{lambda-expression}.
@@ -1716,13 +1716,13 @@
17161716
auto x = 5; // OK: \tcode{x} has type \tcode{int}
17171717
const auto *v = &x, u = 6; // OK: \tcode{v} has type \tcode{const int*}, \tcode{u} has type \tcode{const int}
17181718
static auto y = 0.0; // OK: \tcode{y} has type \tcode{double}
1719-
auto int r; // error: \tcode{auto} is not a \grammarterm{storage-class-specifier}
1719+
auto int r; // error: \keyword{auto} is not a \grammarterm{storage-class-specifier}
17201720
auto f() -> int; // OK: \tcode{f} returns \tcode{int}
17211721
auto g() { return 0.0; } // OK: \tcode{g} returns \tcode{double}
17221722
auto h(); // OK: \tcode{h}'s return type will be deduced when it is defined
17231723
\end{codeblock}
17241724
\end{example}
1725-
The \tcode{auto} \grammarterm{type-specifier}
1725+
The \keyword{auto} \grammarterm{type-specifier}
17261726
can also be used to introduce
17271727
a structured binding declaration\iref{dcl.struct.bind}.
17281728

@@ -1750,8 +1750,8 @@
17501750

17511751
\begin{example}
17521752
\begin{codeblock}
1753-
auto x = 5, *y = &x; // OK: \tcode{auto} is \tcode{int}
1754-
auto a = 5, b = { 1, 2 }; // error: different types for \tcode{auto}
1753+
auto x = 5, *y = &x; // OK: \keyword{auto} is \tcode{int}
1754+
auto a = 5, b = { 1, 2 }; // error: different types for \keyword{auto}
17551755
\end{codeblock}
17561756
\end{example}
17571757

@@ -1836,8 +1836,8 @@
18361836
auto f();
18371837
auto f() { return 42; } // return type is \tcode{int}
18381838
auto f(); // OK
1839-
int f(); // error: \tcode{auto} and \tcode{int} don't match
1840-
decltype(auto) f(); // error: \tcode{auto} and \tcode{decltype(auto)} don't match
1839+
int f(); // error: \keyword{auto} and \tcode{int} don't match
1840+
decltype(auto) f(); // error: \keyword{auto} and \tcode{decltype(auto)} don't match
18411841

18421842
template <typename T> auto g(T t) { return t; } // \#1
18431843
template auto g(int); // OK, return type is \tcode{int}
@@ -1928,7 +1928,7 @@
19281928
or with an operand of type \keyword{void},
19291929
\tcode{T} shall be either
19301930
\opt{\grammarterm{type-constraint}} \tcode{decltype(auto)} or
1931-
\cv{}~\opt{\grammarterm{type-constraint}} \tcode{auto}.
1931+
\cv{}~\opt{\grammarterm{type-constraint}} \keyword{auto}.
19321932

19331933
\pnum
19341934
If the deduction is for a \tcode{return} statement
@@ -1937,13 +1937,13 @@
19371937

19381938
\pnum
19391939
If the \grammarterm{placeholder-type-specifier} is of the form
1940-
\opt{\grammarterm{type-constraint}} \tcode{auto},
1940+
\opt{\grammarterm{type-constraint}} \keyword{auto},
19411941
the deduced type
19421942
$\mathtt{T}'$ replacing \tcode{T}
19431943
is determined using the rules for template argument deduction.
19441944
Obtain \tcode{P} from
19451945
\tcode{T} by replacing the occurrences of
1946-
\opt{\grammarterm{type-constraint}} \tcode{auto} either with
1946+
\opt{\grammarterm{type-constraint}} \keyword{auto} either with
19471947
a new invented type template parameter \tcode{U} or,
19481948
if the initialization is copy-list-initialization, with
19491949
\tcode{std::initializer_list<U>}. Deduce a value for \tcode{U} using the rules
@@ -2149,7 +2149,7 @@
21492149
S S;
21502150
S T; // error
21512151
\end{codeblock}
2152-
Another exception is when \tcode{T} is \tcode{auto}\iref{dcl.spec.auto},
2152+
Another exception is when \tcode{T} is \keyword{auto}\iref{dcl.spec.auto},
21532153
for example:
21542154
\begin{codeblock}
21552155
auto i = 1, j = 2.0; // error: deduced types for \tcode{i} and \tcode{j} do not match
@@ -3365,7 +3365,7 @@
33653365
\tcode{D1}
33663366
is
33673367
``\placeholder{derived-declarator-type-list} \tcode{T}'',
3368-
\tcode{T} shall be the single \grammarterm{type-specifier} \tcode{auto}.
3368+
\tcode{T} shall be the single \grammarterm{type-specifier} \keyword{auto}.
33693369
The type of the
33703370
\grammarterm{declarator-id}
33713371
in
@@ -3727,11 +3727,11 @@
37273727
one invented type \grammarterm{template-parameter}
37283728
for each generic parameter type placeholder
37293729
of the function declaration, in order of appearance.
3730-
For a \grammarterm{placeholder-type-specifier} of the form \tcode{auto},
3730+
For a \grammarterm{placeholder-type-specifier} of the form \keyword{auto},
37313731
the invented parameter is
37323732
an unconstrained \grammarterm{type-parameter}.
37333733
For a \grammarterm{placeholder-type-specifier} of the form
3734-
\grammarterm{type-constraint} \tcode{auto},
3734+
\grammarterm{type-constraint} \keyword{auto},
37353735
the invented parameter is a \grammarterm{type-parameter} with
37363736
that \grammarterm{type-constraint}.
37373737
The invented type \grammarterm{template-parameter} is
@@ -3829,7 +3829,7 @@
38293829
of a \grammarterm{parameter-declaration-clause} without a preceding
38303830
comma. In this case, the ellipsis is parsed as part of the
38313831
\grammarterm{abstract-declarator} if the type of the parameter either names
3832-
a template parameter pack that has not been expanded or contains \tcode{auto};
3832+
a template parameter pack that has not been expanded or contains \keyword{auto};
38333833
otherwise, it is
38343834
parsed as part of the \grammarterm{parameter-declaration-clause}.
38353835
\begin{footnote}

source/expressions.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,7 +1689,7 @@
16891689
If a \grammarterm{lambda-expression} includes an empty
16901690
\grammarterm{lambda-declarator}, it is as if the \grammarterm{lambda-declarator} were
16911691
\tcode{()}.
1692-
The lambda return type is \tcode{auto}, which is replaced by the
1692+
The lambda return type is \keyword{auto}, which is replaced by the
16931693
type specified by the
16941694
\grammarterm{trailing-return-type} if provided and/or deduced from
16951695
\tcode{return} statements as described in~\ref{dcl.spec.auto}.
@@ -6162,7 +6162,7 @@
61626162
if the header \libheaderref{compare}
61636163
is not imported or included prior to a use of such a class type --
61646164
even an implicit use in which the type is not named
6165-
(e.g., via the \tcode{auto} specifier\iref{dcl.spec.auto}
6165+
(e.g., via the \keyword{auto} specifier\iref{dcl.spec.auto}
61666166
in a defaulted three-way comparison\iref{class.spaceship}
61676167
or use of the built-in operator) -- the program is ill-formed.
61686168

source/statements.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
declaration\iref{dcl.dcl}.
8484
The \grammarterm{declarator} shall not
8585
specify a function or an array. The \grammarterm{decl-specifier-seq} shall not
86-
define a class or enumeration. If the \tcode{auto} \grammarterm{type-specifier} appears in
86+
define a class or enumeration. If the \keyword{auto} \grammarterm{type-specifier} appears in
8787
the \grammarterm{decl-specifier-seq},
8888
the type of the identifier being declared is deduced from the initializer as described in~\ref{dcl.spec.auto}.
8989

source/templates.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6179,7 +6179,7 @@
61796179
template int *var<int>; // error: instantiated variable has type \tcode{int}
61806180

61816181
template<typename T> auto av = T();
6182-
template int av<int>; // OK, variable with type \tcode{int} can be redeclared with type \tcode{auto}
6182+
template int av<int>; // OK, variable with type \tcode{int} can be redeclared with type \keyword{auto}
61836183

61846184
template<typename T> auto f() {}
61856185
template void f<int>(); // error: function with deduced return type

0 commit comments

Comments
 (0)