From Jason Turner

[namespace.memdef]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp9q8nb6cx/{from.md → to.md} +26 -26
tmp/tmp9q8nb6cx/{from.md → to.md} RENAMED
@@ -1,17 +1,17 @@
1
  #### Namespace member definitions <a id="namespace.memdef">[[namespace.memdef]]</a>
2
 
3
  A declaration in a namespace `N` (excluding declarations in nested
4
- scopes) whose *declarator-id* is an *unqualified-id* ([[dcl.meaning]]),
5
- whose *class-head-name* (Clause [[class]]) or *enum-head-name* (
6
- [[dcl.enum]]) is an *identifier*, or whose *elaborated-type-specifier*
7
- is of the form *class-key* *attribute-specifier-seq*ₒₚₜ *identifier* (
8
- [[dcl.type.elab]]), or that is an *opaque-enum-declaration*, declares
9
- (or redeclares) its *unqualified-id* or *identifier* as a member of `N`.
10
 
11
- [*Note 1*: An explicit instantiation ([[temp.explicit]]) or explicit
12
- specialization ([[temp.expl.spec]]) of a template does not introduce a
13
  name and thus may be declared using an *unqualified-id* in a member of
14
  the enclosing namespace set, if the primary template is declared in an
15
  inline namespace. — *end note*]
16
 
17
  [*Example 1*:
@@ -29,14 +29,14 @@ namespace X {
29
  ```
30
 
31
  — *end example*]
32
 
33
  Members of a named namespace can also be defined outside that namespace
34
- by explicit qualification ([[namespace.qual]]) of the name being
35
- defined, provided that the entity being defined was already declared in
36
- the namespace and the definition appears after the point of declaration
37
- in a namespace that encloses the declaration’s namespace.
38
 
39
  [*Example 2*:
40
 
41
  ``` cpp
42
  namespace Q {
@@ -55,32 +55,32 @@ namespace R {
55
  }
56
  ```
57
 
58
  — *end example*]
59
 
60
- If a `friend` declaration in a non-local class first declares a class,
61
- function, class template or function template[^5] the friend is a member
62
- of the innermost enclosing namespace. The `friend` declaration does not
63
- by itself make the name visible to unqualified lookup (
64
- [[basic.lookup.unqual]]) or qualified lookup ([[basic.lookup.qual]]).
65
 
66
  [*Note 2*: The name of the friend will be visible in its namespace if a
67
  matching declaration is provided at namespace scope (either before or
68
  after the class definition granting friendship). — *end note*]
69
 
70
  If a friend function or function template is called, its name may be
71
  found by the name lookup that considers functions from namespaces and
72
- classes associated with the types of the function arguments (
73
- [[basic.lookup.argdep]]). If the name in a `friend` declaration is
74
- neither qualified nor a *template-id* and the declaration is a function
75
- or an *elaborated-type-specifier*, the lookup to determine whether the
76
- entity has been previously declared shall not consider any scopes
77
- outside the innermost enclosing namespace.
78
 
79
- [*Note 3*: The other forms of `friend` declarations cannot declare a
80
- new member of the innermost enclosing namespace and thus follow the
81
- usual lookup rules. — *end note*]
82
 
83
  [*Example 3*:
84
 
85
  ``` cpp
86
  // Assume f and g have not yet been declared.
 
1
  #### Namespace member definitions <a id="namespace.memdef">[[namespace.memdef]]</a>
2
 
3
  A declaration in a namespace `N` (excluding declarations in nested
4
+ scopes) whose *declarator-id* is an *unqualified-id* [[dcl.meaning]],
5
+ whose *class-head-name* [[class.pre]] or *enum-head-name* [[dcl.enum]]
6
+ is an *identifier*, or whose *elaborated-type-specifier* is of the form
7
+ *class-key* *attribute-specifier-seq*ₒₚₜ *identifier*
8
+ [[dcl.type.elab]], or that is an *opaque-enum-declaration*, declares (or
9
+ redeclares) its *unqualified-id* or *identifier* as a member of `N`.
10
 
11
+ [*Note 1*: An explicit instantiation [[temp.explicit]] or explicit
12
+ specialization [[temp.expl.spec]] of a template does not introduce a
13
  name and thus may be declared using an *unqualified-id* in a member of
14
  the enclosing namespace set, if the primary template is declared in an
15
  inline namespace. — *end note*]
16
 
17
  [*Example 1*:
 
29
  ```
30
 
31
  — *end example*]
32
 
33
  Members of a named namespace can also be defined outside that namespace
34
+ by explicit qualification [[namespace.qual]] of the name being defined,
35
+ provided that the entity being defined was already declared in the
36
+ namespace and the definition appears after the point of declaration in a
37
+ namespace that encloses the declaration’s namespace.
38
 
39
  [*Example 2*:
40
 
41
  ``` cpp
42
  namespace Q {
 
55
  }
56
  ```
57
 
58
  — *end example*]
59
 
60
+ If a friend declaration in a non-local class first declares a class,
61
+ function, class template or function template[^10] the friend is a
62
+ member of the innermost enclosing namespace. The friend declaration does
63
+ not by itself make the name visible to unqualified lookup
64
+ [[basic.lookup.unqual]] or qualified lookup [[basic.lookup.qual]].
65
 
66
  [*Note 2*: The name of the friend will be visible in its namespace if a
67
  matching declaration is provided at namespace scope (either before or
68
  after the class definition granting friendship). — *end note*]
69
 
70
  If a friend function or function template is called, its name may be
71
  found by the name lookup that considers functions from namespaces and
72
+ classes associated with the types of the function arguments
73
+ [[basic.lookup.argdep]]. If the name in a friend declaration is neither
74
+ qualified nor a *template-id* and the declaration is a function or an
75
+ *elaborated-type-specifier*, the lookup to determine whether the entity
76
+ has been previously declared shall not consider any scopes outside the
77
+ innermost enclosing namespace.
78
 
79
+ [*Note 3*: The other forms of friend declarations cannot declare a new
80
+ member of the innermost enclosing namespace and thus follow the usual
81
+ lookup rules. — *end note*]
82
 
83
  [*Example 3*:
84
 
85
  ``` cpp
86
  // Assume f and g have not yet been declared.