diff --git a/source/classes.tex b/source/classes.tex index 63ed54f3f4..4929e36734 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -842,9 +842,10 @@ \pnum \indextext{member function!inline}% \indextext{definition!member function}% -A member function may be defined\iref{dcl.fct.def} in its class -definition, in which case it is an inline member -function\iref{dcl.inline}, or it may be defined outside of its class +A member function may be defined\iref{dcl.fct.def} in its class definition, +in which case it is an inline\iref{dcl.inline} member function +if it is attached to the global module, or +it may be defined outside of its class definition if it has already been declared but not defined in its class definition. A member function definition that appears outside of the class definition shall appear in a namespace scope enclosing the class @@ -5192,7 +5193,8 @@ \end{example} \pnum -Such a function is implicitly an inline function\iref{dcl.inline}. +Such a function is implicitly an inline\iref{dcl.inline} function +if it is attached to the global module. A friend function defined in a class is in the (lexical) scope of the class in which it is defined. A friend function defined outside the class is not\iref{basic.lookup.unqual}. diff --git a/source/declarations.tex b/source/declarations.tex index 7087d63700..d51bd143d3 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -1059,9 +1059,6 @@ A variable declaration with an \tcode{inline} specifier declares an \defnadj{inline}{variable}. -\pnum -A function defined within a class definition is an inline function. - \pnum The \tcode{inline} specifier shall not appear on a block scope declaration or on the declaration of a function parameter. @@ -1108,6 +1105,8 @@ There is no restriction on the linkage (or absence thereof) of entities that the function body of an exported inline function can reference. A constexpr function\iref{dcl.constexpr} is implicitly inline. +In the global module, a function defined within a class definition +is implicitly inline~(\ref{class.mfct}, \ref{class.friend}). \end{note} \rSec2[dcl.type]{Type specifiers}% @@ -6030,7 +6029,8 @@ An explicitly-defaulted function that is not defined as deleted may be declared \tcode{constexpr} or \tcode{consteval} only if it would have been implicitly declared as \tcode{constexpr}. -If a function is explicitly defaulted on its first declaration, +A function explicitly defaulted on its first declaration +is inline\iref{dcl.inline}; it is implicitly considered to be \tcode{constexpr} if the implicit declaration would be.