Skip to content

Commit 1cbfcde

Browse files
committed
[dcl.inline] inline specifier is for ODR
The key use of the inline specifier since C++11, if not before, has been to allow multiple declarations to satisfy the ODR rather than to provide a hint that compilers routinely ignore. This change moves but does not change wording, in order to move the comment making the connection with the ODR more prominent than the normative wording suggestings core transformation. It might be desirable to demote the normative coding hint to a note, but that goes beyond the remit of a simple editorial chsnge.
1 parent b74580a commit 1cbfcde

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

source/declarations.tex

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,31 +1089,40 @@
10891089
\rSec2[dcl.inline]{The \keyword{inline} specifier}%
10901090
\indextext{specifier!\idxcode{inline}}
10911091

1092-
\pnum
1093-
The \keyword{inline} specifier shall be applied only to the declaration
1094-
of a variable or function.
1095-
10961092
\pnum
10971093
\indextext{specifier!\idxcode{inline}}%
10981094
\indextext{inline function}%
1095+
\indextext{inline variable}%
1096+
The \keyword{inline} specifier shall be applied only to the declaration
1097+
of a function or variable.
10991098
A function declaration\iref{dcl.fct,class.mfct,class.friend}
11001099
with an \keyword{inline} specifier declares an
1101-
\defnadj{inline}{function}. The inline specifier indicates to
1102-
the implementation that inline substitution of the function body at the
1103-
point of call is to be preferred to the usual function call mechanism.
1104-
An implementation is not required to perform this inline substitution at
1105-
the point of call; however, even if this inline substitution is omitted,
1106-
the other rules for inline functions specified in this subclause shall
1107-
still be respected.
1100+
\defnadj{inline}{function}.
1101+
A variable declaration with an \keyword{inline} specifier declares an
1102+
\defnadj{inline}{variable}.
1103+
\begin{note}
1104+
An inline function or variable
1105+
with external or module linkage
1106+
can be defined in multiple translation units\iref{basic.def.odr},
1107+
but is one entity with one address.
1108+
A type or \keyword{static} variable
1109+
defined in the body of such a function
1110+
is therefore a single entity.
1111+
\end{note}
11081112
\begin{note}
11091113
The \keyword{inline} keyword has no effect on the linkage of a function.
11101114
In certain cases, an inline function cannot use names with internal linkage;
11111115
see~\ref{basic.link}.
11121116
\end{note}
11131117

11141118
\pnum
1115-
A variable declaration with an \keyword{inline} specifier declares an
1116-
\defnadj{inline}{variable}.
1119+
The inline specifier indicates to
1120+
the implementation that inline substitution of the function body at the
1121+
point of call is to be preferred to the usual function call mechanism.
1122+
An implementation is not required to perform this inline substitution at
1123+
the point of call; however, even if this inline substitution is omitted,
1124+
the other rules for inline functions specified in this subclause shall
1125+
still be respected.
11171126

11181127
\pnum
11191128
The \keyword{inline} specifier shall not appear on a block scope declaration or
@@ -1136,17 +1145,6 @@
11361145
before its definition becomes reachable in a translation unit.
11371146
\end{note}
11381147

1139-
\pnum
1140-
\begin{note}
1141-
An inline function or variable
1142-
with external or module linkage
1143-
can be defined in multiple translation units\iref{basic.def.odr},
1144-
but is one entity with one address.
1145-
A type or \keyword{static} variable
1146-
defined in the body of such a function
1147-
is therefore a single entity.
1148-
\end{note}
1149-
11501148
\pnum
11511149
If an inline function or variable that is attached to a named module
11521150
is declared in a definition domain,

0 commit comments

Comments
 (0)