From Jason Turner

[dcl.inline]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmph8hk6zf8/{from.md → to.md} +34 -28
tmp/tmph8hk6zf8/{from.md → to.md} RENAMED
@@ -1,45 +1,51 @@
1
  ### The `inline` specifier <a id="dcl.inline">[[dcl.inline]]</a>
2
 
3
- The `inline` specifier can be applied only to the declaration or
4
- definition of a variable or function.
5
 
6
- A function declaration ([[dcl.fct]],  [[class.mfct]], [[class.friend]])
7
  with an `inline` specifier declares an *inline function*. The inline
8
  specifier indicates to the implementation that inline substitution of
9
  the function body at the point of call is to be preferred to the usual
10
  function call mechanism. An implementation is not required to perform
11
  this inline substitution at the point of call; however, even if this
12
  inline substitution is omitted, the other rules for inline functions
13
- specified in this section shall still be respected.
14
 
15
- A variable declaration with an `inline` specifier declares an *inline
16
- variable*.
 
17
 
18
- A function defined within a class definition is an inline function.
 
19
 
20
- The `inline` specifier shall not appear on a block scope
21
- declaration.[^2] If the `inline` specifier is used in a friend function
22
- declaration, that declaration shall be a definition or the function
23
- shall have previously been declared inline.
24
 
25
- An inline function or variable shall be defined in every translation
26
- unit in which it is odr-used and shall have exactly the same definition
27
- in every case ([[basic.def.odr]]).
 
 
 
28
 
29
- [*Note 1*: A call to the inline function or a use of the inline
30
- variable may be encountered before its definition appears in the
31
  translation unit. — *end note*]
32
 
33
- If the definition of a function or variable appears in a translation
34
- unit before its first declaration as inline, the program is ill-formed.
35
- If a function or variable with external linkage is declared inline in
36
- one translation unit, it shall be declared inline in all translation
37
- units in which it appears; no diagnostic is required. An inline function
38
- or variable with external linkage shall have the same address in all
39
- translation units.
40
-
41
- [*Note 2*: A `static` local variable in an inline function with
42
- external linkage always refers to the same object. A type defined within
43
- the body of an inline function with external linkage is the same type in
44
- every translation unit. *end note*]
 
45
 
 
1
  ### The `inline` specifier <a id="dcl.inline">[[dcl.inline]]</a>
2
 
3
+ The `inline` specifier shall be applied only to the declaration of a
4
+ variable or function.
5
 
6
+ A function declaration ([[dcl.fct]], [[class.mfct]], [[class.friend]])
7
  with an `inline` specifier declares an *inline function*. The inline
8
  specifier indicates to the implementation that inline substitution of
9
  the function body at the point of call is to be preferred to the usual
10
  function call mechanism. An implementation is not required to perform
11
  this inline substitution at the point of call; however, even if this
12
  inline substitution is omitted, the other rules for inline functions
13
+ specified in this subclause shall still be respected.
14
 
15
+ [*Note 1*: The `inline` keyword has no effect on the linkage of a
16
+ function. In certain cases, an inline function cannot use names with
17
+ internal linkage; see  [[basic.link]]. — *end note*]
18
 
19
+ A variable declaration with an `inline` specifier declares an
20
+ *inline variable*.
21
 
22
+ The `inline` specifier shall not appear on a block scope declaration or
23
+ on the declaration of a function parameter. If the `inline` specifier is
24
+ used in a friend function declaration, that declaration shall be a
25
+ definition or the function shall have previously been declared inline.
26
 
27
+ If a definition of a function or variable is reachable at the point of
28
+ its first declaration as inline, the program is ill-formed. If a
29
+ function or variable with external or module linkage is declared inline
30
+ in one definition domain, an inline declaration of it shall be reachable
31
+ from the end of every definition domain in which it is declared; no
32
+ diagnostic is required.
33
 
34
+ [*Note 2*: A call to an inline function or a use of an inline variable
35
+ may be encountered before its definition becomes reachable in a
36
  translation unit. — *end note*]
37
 
38
+ [*Note 3*: An inline function or variable with external or module
39
+ linkage has the same address in all translation units. A `static` local
40
+ variable in an inline function with external or module linkage always
41
+ refers to the same object. A type defined within the body of an inline
42
+ function with external or module linkage is the same type in every
43
+ translation unit. *end note*]
44
+
45
+ If an inline function or variable that is attached to a named module is
46
+ declared in a definition domain, it shall be defined in that domain.
47
+
48
+ [*Note 4*: A constexpr function [[dcl.constexpr]] is implicitly inline.
49
+ In the global module, a function defined within a class definition is
50
+ implicitly inline ([[class.mfct]], [[class.friend]]). — *end note*]
51