Skip to content

Commit 106d000

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 106d000

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

source/declarations.tex

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,9 +1096,24 @@
10961096
\pnum
10971097
\indextext{specifier!\idxcode{inline}}%
10981098
\indextext{inline function}%
1099+
\indextext{inline variable}%
1100+
A variable declaration with an \keyword{inline} specifier declares an
1101+
\defnadj{inline}{variable}.
10991102
A function declaration\iref{dcl.fct,class.mfct,class.friend}
11001103
with an \keyword{inline} specifier declares an
1101-
\defnadj{inline}{function}. The inline specifier indicates to
1104+
\defnadj{inline}{function}.
1105+
\begin{note}
1106+
An inline function or variable
1107+
with external or module linkage
1108+
can be defined in multiple translation units\iref{basic.def.odr},
1109+
but is one entity with one address.
1110+
A type or \keyword{static} variable
1111+
defined in the body of such a function
1112+
is therefore a single entity.
1113+
\end{note}
1114+
1115+
\pnum
1116+
The inline specifier indicates to
11021117
the implementation that inline substitution of the function body at the
11031118
point of call is to be preferred to the usual function call mechanism.
11041119
An implementation is not required to perform this inline substitution at
@@ -1111,10 +1126,6 @@
11111126
see~\ref{basic.link}.
11121127
\end{note}
11131128

1114-
\pnum
1115-
A variable declaration with an \keyword{inline} specifier declares an
1116-
\defnadj{inline}{variable}.
1117-
11181129
\pnum
11191130
The \keyword{inline} specifier shall not appear on a block scope declaration or
11201131
on the declaration of a function parameter.
@@ -1136,17 +1147,6 @@
11361147
before its definition becomes reachable in a translation unit.
11371148
\end{note}
11381149

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-
11501150
\pnum
11511151
If an inline function or variable that is attached to a named module
11521152
is declared in a definition domain,

0 commit comments

Comments
 (0)