From Jason Turner

[basic.def]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmps4tbgtnk/{from.md → to.md} +48 -23
tmp/tmps4tbgtnk/{from.md → to.md} RENAMED
@@ -6,30 +6,47 @@ declarations. If so, the declaration specifies the interpretation and
6
  attributes of these names. A declaration may also have effects
7
  including:
8
 
9
  - a static assertion (Clause  [[dcl.dcl]]),
10
  - controlling template instantiation ([[temp.explicit]]),
 
 
11
  - use of attributes (Clause  [[dcl.dcl]]), and
12
  - nothing (in the case of an *empty-declaration*).
13
 
14
- A declaration is a *definition* unless it declares a function without
15
- specifying the function’s body ([[dcl.fct.def]]), it contains the
16
- `extern` specifier ([[dcl.stc]]) or a *linkage-specification*[^1] (
17
- [[dcl.link]]) and neither an *initializer* nor a *function-body*, it
18
- declares a static data member in a class definition ([[class.mem]], 
19
- [[class.static]]), it is a class name declaration ([[class.name]]), it
20
- is an *opaque-enum-declaration* ([[dcl.enum]]), it is a
21
- *template-parameter* ([[temp.param]]), it is a
22
- *parameter-declaration* ([[dcl.fct]]) in a function declarator that is
23
- not the *declarator* of a *function-definition*, or it is a `typedef`
24
- declaration ([[dcl.typedef]]), an *alias-declaration* (
25
- [[dcl.typedef]]), a *using-declaration* ([[namespace.udecl]]), a
26
- *static_assert-declaration* (Clause  [[dcl.dcl]]), an
27
- *attribute-declaration* (Clause  [[dcl.dcl]]), an *empty-declaration*
28
- (Clause  [[dcl.dcl]]), or a *using-directive* ([[namespace.udir]]).
29
 
30
- all but one of the following are definitions:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  ``` cpp
33
  int a; // defines a
34
  extern const int c = 1; // defines c
35
  int f(int x) { return x+a; } // defines f and defines x
@@ -56,15 +73,21 @@ struct S; // declares S
56
  typedef int Int; // declares Int
57
  extern X anotherX; // declares anotherX
58
  using N::d; // declares d
59
  ```
60
 
61
- In some circumstances, C++implementations implicitly define the default
62
- constructor ([[class.ctor]]), copy constructor ([[class.copy]]), move
63
- constructor ([[class.copy]]), copy assignment operator (
64
- [[class.copy]]), move assignment operator ([[class.copy]]), or
65
- destructor ([[class.dtor]]) member functions. given
 
 
 
 
 
 
66
 
67
  ``` cpp
68
  #include <string>
69
 
70
  struct C {
@@ -93,11 +116,13 @@ struct C {
93
  // { s = std::move(x.s); return *this; }
94
  ~C() { }
95
  };
96
  ```
97
 
98
- A class name can also be implicitly declared by an
99
- *elaborated-type-specifier* ([[dcl.type.elab]]).
 
 
100
 
101
  A program is ill-formed if the definition of any object gives the object
102
  an incomplete type ([[basic.types]]).
103
 
 
6
  attributes of these names. A declaration may also have effects
7
  including:
8
 
9
  - a static assertion (Clause  [[dcl.dcl]]),
10
  - controlling template instantiation ([[temp.explicit]]),
11
+ - guiding template argument deduction for constructors (
12
+ [[temp.deduct.guide]]),
13
  - use of attributes (Clause  [[dcl.dcl]]), and
14
  - nothing (in the case of an *empty-declaration*).
15
 
16
+ A declaration is a *definition* unless
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
+ - it declares a function without specifying the function’s body (
19
+ [[dcl.fct.def]]),
20
+ - it contains the `extern` specifier ([[dcl.stc]]) or a
21
+ *linkage-specification*[^1] ([[dcl.link]]) and neither an
22
+ *initializer* nor a *function-body*,
23
+ - it declares a non-inline static data member in a class definition (
24
+ [[class.mem]],  [[class.static]]),
25
+ - it declares a static data member outside a class definition and the
26
+ variable was defined within the class with the `constexpr` specifier
27
+ (this usage is deprecated; see [[depr.static_constexpr]]),
28
+ - it is a class name declaration ([[class.name]]),
29
+ - it is an *opaque-enum-declaration* ([[dcl.enum]]),
30
+ - it is a *template-parameter* ([[temp.param]]),
31
+ - it is a *parameter-declaration* ([[dcl.fct]]) in a function
32
+ declarator that is not the *declarator* of a *function-definition*,
33
+ - it is a `typedef` declaration ([[dcl.typedef]]),
34
+ - it is an *alias-declaration* ([[dcl.typedef]]),
35
+ - it is a *using-declaration* ([[namespace.udecl]]),
36
+ - it is a *deduction-guide* ([[temp.deduct.guide]]),
37
+ - it is a *static_assert-declaration* (Clause  [[dcl.dcl]]),
38
+ - it is an *attribute-declaration* (Clause  [[dcl.dcl]]),
39
+ - it is an *empty-declaration* (Clause  [[dcl.dcl]]),
40
+ - it is a *using-directive* ([[namespace.udir]]),
41
+ - it is an explicit instantiation declaration ([[temp.explicit]]), or
42
+ - it is an explicit specialization ([[temp.expl.spec]]) whose
43
+ *declaration* is not a definition.
44
+
45
+ [*Example 1*:
46
+
47
+ All but one of the following are definitions:
48
 
49
  ``` cpp
50
  int a; // defines a
51
  extern const int c = 1; // defines c
52
  int f(int x) { return x+a; } // defines f and defines x
 
73
  typedef int Int; // declares Int
74
  extern X anotherX; // declares anotherX
75
  using N::d; // declares d
76
  ```
77
 
78
+ *end example*]
79
+
80
+ [*Note 1*: In some circumstances, C++implementations implicitly define
81
+ the default constructor ([[class.ctor]]), copy constructor (
82
+ [[class.copy]]), move constructor ([[class.copy]]), copy assignment
83
+ operator ([[class.copy]]), move assignment operator ([[class.copy]]),
84
+ or destructor ([[class.dtor]]) member functions. — *end note*]
85
+
86
+ [*Example 2*:
87
+
88
+ Given
89
 
90
  ``` cpp
91
  #include <string>
92
 
93
  struct C {
 
116
  // { s = std::move(x.s); return *this; }
117
  ~C() { }
118
  };
119
  ```
120
 
121
+ *end example*]
122
+
123
+ [*Note 2*: A class name can also be implicitly declared by an
124
+ *elaborated-type-specifier* ([[dcl.type.elab]]). — *end note*]
125
 
126
  A program is ill-formed if the definition of any object gives the object
127
  an incomplete type ([[basic.types]]).
128