tmp/tmp4t09y4e6/{from.md → to.md}
RENAMED
|
@@ -7,15 +7,16 @@ member-specification:
|
|
| 7 |
```
|
| 8 |
|
| 9 |
``` bnf
|
| 10 |
member-declaration:
|
| 11 |
attribute-specifier-seqₒₚₜ decl-specifier-seqₒₚₜ member-declarator-listₒₚₜ ';'
|
| 12 |
-
function-definition
|
| 13 |
using-declaration
|
| 14 |
static_assert-declaration
|
| 15 |
template-declaration
|
| 16 |
alias-declaration
|
|
|
|
| 17 |
```
|
| 18 |
|
| 19 |
``` bnf
|
| 20 |
member-declarator-list:
|
| 21 |
member-declarator
|
|
@@ -53,39 +54,37 @@ types, and enumerators. Data members and member functions are static or
|
|
| 53 |
non-static; see [[class.static]]. Nested types are classes (
|
| 54 |
[[class.name]], [[class.nest]]) and enumerations ([[dcl.enum]])
|
| 55 |
defined in the class, and arbitrary types declared as members by use of
|
| 56 |
a typedef declaration ([[dcl.typedef]]). The enumerators of an unscoped
|
| 57 |
enumeration ([[dcl.enum]]) defined in the class are members of the
|
| 58 |
-
class. Except when used to declare friends ([[class.friend]])
|
| 59 |
-
|
| 60 |
-
[[namespace.udecl]]),
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
|
|
|
| 67 |
|
| 68 |
A class is considered a completely-defined object type (
|
| 69 |
[[basic.types]]) (or complete type) at the closing `}` of the
|
| 70 |
*class-specifier*. Within the class *member-specification*, the class is
|
| 71 |
regarded as complete within function bodies, default arguments,
|
| 72 |
-
*
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
|
|
|
| 76 |
|
| 77 |
A single name can denote several function members provided their types
|
| 78 |
are sufficiently different (Clause [[over]]).
|
| 79 |
|
| 80 |
-
A
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
A member can be initialized using a *brace-or-equal-initializer*. (For
|
| 85 |
-
static data members, see [[class.static.data]]; for non-static data
|
| 86 |
-
members, see [[class.base.init]]).
|
| 87 |
|
| 88 |
A member shall not be declared with the `extern` or `register` . Within
|
| 89 |
a class definition, a member shall not be declared with the
|
| 90 |
`thread_local` unless also declared `static`.
|
| 91 |
|
|
@@ -143,14 +142,14 @@ pointer of the object `s`; and `s.right->tword[0]` refers to the initial
|
|
| 143 |
character of the `tword` member of the `right` subtree of `s`.
|
| 144 |
|
| 145 |
Nonstatic data members of a (non-union) class with the same access
|
| 146 |
control (Clause [[class.access]]) are allocated so that later members
|
| 147 |
have higher addresses within a class object. The order of allocation of
|
| 148 |
-
non-static data members with different access control is unspecified
|
| 149 |
-
[[class.access]]). Implementation alignment requirements might
|
| 150 |
-
adjacent members not to be allocated immediately after each
|
| 151 |
-
might requirements for space for managing virtual functions (
|
| 152 |
[[class.virtual]]) and virtual base classes ([[class.mi]]).
|
| 153 |
|
| 154 |
If `T` is the name of a class, then each of the following shall have a
|
| 155 |
name different from `T`:
|
| 156 |
|
|
@@ -165,16 +164,16 @@ name different from `T`:
|
|
| 165 |
In addition, if class `T` has a user-declared constructor (
|
| 166 |
[[class.ctor]]), every non-static data member of class `T` shall have a
|
| 167 |
name different from `T`.
|
| 168 |
|
| 169 |
Two standard-layout struct (Clause [[class]]) types are
|
| 170 |
-
layout-compatible if they have the same number of non-static data
|
| 171 |
members and corresponding non-static data members (in declaration order)
|
| 172 |
have layout-compatible types ([[basic.types]]).
|
| 173 |
|
| 174 |
Two standard-layout union (Clause [[class]]) types are
|
| 175 |
-
layout-compatible if they have the same number of non-static data
|
| 176 |
members and corresponding non-static data members (in any order) have
|
| 177 |
layout-compatible types ([[basic.types]]).
|
| 178 |
|
| 179 |
If a standard-layout union contains two or more standard-layout structs
|
| 180 |
that share a common initial sequence, and if the standard-layout union
|
|
@@ -183,12 +182,12 @@ permitted to inspect the common initial part of any of them. Two
|
|
| 183 |
standard-layout structs share a common initial sequence if corresponding
|
| 184 |
members have layout-compatible types and either neither member is a
|
| 185 |
bit-field or both are bit-fields with the same width for a sequence of
|
| 186 |
one or more initial members.
|
| 187 |
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
might therefore be unnamed padding
|
| 192 |
-
object, but not at its beginning, as
|
| 193 |
-
alignment.
|
| 194 |
|
|
|
|
| 7 |
```
|
| 8 |
|
| 9 |
``` bnf
|
| 10 |
member-declaration:
|
| 11 |
attribute-specifier-seqₒₚₜ decl-specifier-seqₒₚₜ member-declarator-listₒₚₜ ';'
|
| 12 |
+
function-definition
|
| 13 |
using-declaration
|
| 14 |
static_assert-declaration
|
| 15 |
template-declaration
|
| 16 |
alias-declaration
|
| 17 |
+
empty-declaration
|
| 18 |
```
|
| 19 |
|
| 20 |
``` bnf
|
| 21 |
member-declarator-list:
|
| 22 |
member-declarator
|
|
|
|
| 54 |
non-static; see [[class.static]]. Nested types are classes (
|
| 55 |
[[class.name]], [[class.nest]]) and enumerations ([[dcl.enum]])
|
| 56 |
defined in the class, and arbitrary types declared as members by use of
|
| 57 |
a typedef declaration ([[dcl.typedef]]). The enumerators of an unscoped
|
| 58 |
enumeration ([[dcl.enum]]) defined in the class are members of the
|
| 59 |
+
class. Except when used to declare friends ([[class.friend]]), to
|
| 60 |
+
declare an unnamed bit-field ([[class.bit]]), or to introduce the name
|
| 61 |
+
of a member of a base class into a derived class ([[namespace.udecl]]),
|
| 62 |
+
or when the declaration is an *empty-declaration*, *member-declaration*s
|
| 63 |
+
declare members of the class, and each such *member-declaration* shall
|
| 64 |
+
declare at least one member name of the class. A member shall not be
|
| 65 |
+
declared twice in the *member-specification*, except that a nested class
|
| 66 |
+
or member class template can be declared and then later defined, and
|
| 67 |
+
except that an enumeration can be introduced with an
|
| 68 |
+
*opaque-enum-declaration* and later redeclared with an *enum-specifier*.
|
| 69 |
|
| 70 |
A class is considered a completely-defined object type (
|
| 71 |
[[basic.types]]) (or complete type) at the closing `}` of the
|
| 72 |
*class-specifier*. Within the class *member-specification*, the class is
|
| 73 |
regarded as complete within function bodies, default arguments,
|
| 74 |
+
*using-declaration*s introducing inheriting constructors (
|
| 75 |
+
[[class.inhctor]]), *exception-specification*s, and
|
| 76 |
+
*brace-or-equal-initializer*s for non-static data members (including
|
| 77 |
+
such things in nested classes). Otherwise it is regarded as incomplete
|
| 78 |
+
within its own class *member-specification*.
|
| 79 |
|
| 80 |
A single name can denote several function members provided their types
|
| 81 |
are sufficiently different (Clause [[over]]).
|
| 82 |
|
| 83 |
+
A *brace-or-equal-initializer* shall appear only in the declaration of a
|
| 84 |
+
data member. (For static data members, see [[class.static.data]]; for
|
| 85 |
+
non-static data members, see [[class.base.init]]).
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
A member shall not be declared with the `extern` or `register` . Within
|
| 88 |
a class definition, a member shall not be declared with the
|
| 89 |
`thread_local` unless also declared `static`.
|
| 90 |
|
|
|
|
| 142 |
character of the `tword` member of the `right` subtree of `s`.
|
| 143 |
|
| 144 |
Nonstatic data members of a (non-union) class with the same access
|
| 145 |
control (Clause [[class.access]]) are allocated so that later members
|
| 146 |
have higher addresses within a class object. The order of allocation of
|
| 147 |
+
non-static data members with different access control is unspecified
|
| 148 |
+
(Clause [[class.access]]). Implementation alignment requirements might
|
| 149 |
+
cause two adjacent members not to be allocated immediately after each
|
| 150 |
+
other; so might requirements for space for managing virtual functions (
|
| 151 |
[[class.virtual]]) and virtual base classes ([[class.mi]]).
|
| 152 |
|
| 153 |
If `T` is the name of a class, then each of the following shall have a
|
| 154 |
name different from `T`:
|
| 155 |
|
|
|
|
| 164 |
In addition, if class `T` has a user-declared constructor (
|
| 165 |
[[class.ctor]]), every non-static data member of class `T` shall have a
|
| 166 |
name different from `T`.
|
| 167 |
|
| 168 |
Two standard-layout struct (Clause [[class]]) types are
|
| 169 |
+
*layout-compatible* if they have the same number of non-static data
|
| 170 |
members and corresponding non-static data members (in declaration order)
|
| 171 |
have layout-compatible types ([[basic.types]]).
|
| 172 |
|
| 173 |
Two standard-layout union (Clause [[class]]) types are
|
| 174 |
+
*layout-compatible* if they have the same number of non-static data
|
| 175 |
members and corresponding non-static data members (in any order) have
|
| 176 |
layout-compatible types ([[basic.types]]).
|
| 177 |
|
| 178 |
If a standard-layout union contains two or more standard-layout structs
|
| 179 |
that share a common initial sequence, and if the standard-layout union
|
|
|
|
| 182 |
standard-layout structs share a common initial sequence if corresponding
|
| 183 |
members have layout-compatible types and either neither member is a
|
| 184 |
bit-field or both are bit-fields with the same width for a sequence of
|
| 185 |
one or more initial members.
|
| 186 |
|
| 187 |
+
If a standard-layout class object has any non-static data members, its
|
| 188 |
+
address is the same as the address of its first non-static data member.
|
| 189 |
+
Otherwise, its address is the same as the address of its first base
|
| 190 |
+
class subobject (if any). There might therefore be unnamed padding
|
| 191 |
+
within a standard-layout struct object, but not at its beginning, as
|
| 192 |
+
necessary to achieve appropriate alignment.
|
| 193 |
|