From Jason Turner

[dcl.attr.nouniqueaddr]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp0mpke6q1/{from.md → to.md} +305 -0
tmp/tmp0mpke6q1/{from.md → to.md} RENAMED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### No unique address attribute <a id="dcl.attr.nouniqueaddr">[[dcl.attr.nouniqueaddr]]</a>
2
+
3
+ The *attribute-token* `no_unique_address` specifies that a non-static
4
+ data member is a potentially-overlapping subobject [[intro.object]]. It
5
+ shall appear at most once in each *attribute-list* and no
6
+ *attribute-argument-clause* shall be present. The attribute may
7
+ appertain to a non-static data member other than a bit-field.
8
+
9
+ [*Note 1*: The non-static data member can share the address of another
10
+ non-static data member or that of a base class, and any padding that
11
+ would normally be inserted at the end of the object can be reused as
12
+ storage for other members. — *end note*]
13
+
14
+ [*Example 1*:
15
+
16
+ ``` cpp
17
+ template<typename Key, typename Value,
18
+ typename Hash, typename Pred, typename Allocator>
19
+ class hash_map {
20
+ [[no_unique_address]] Hash hasher;
21
+ [[no_unique_address]] Pred pred;
22
+ [[no_unique_address]] Allocator alloc;
23
+ Bucket *buckets;
24
+ // ...
25
+ public:
26
+ // ...
27
+ };
28
+ ```
29
+
30
+ Here, `hasher`, `pred`, and `alloc` could have the same address as
31
+ `buckets` if their respective types are all empty.
32
+
33
+ — *end example*]
34
+
35
+ <!-- Link reference definitions -->
36
+ [basic.align]: basic.md#basic.align
37
+ [basic.compound]: basic.md#basic.compound
38
+ [basic.def]: basic.md#basic.def
39
+ [basic.def.odr]: basic.md#basic.def.odr
40
+ [basic.fundamental]: basic.md#basic.fundamental
41
+ [basic.life]: basic.md#basic.life
42
+ [basic.link]: basic.md#basic.link
43
+ [basic.lookup]: basic.md#basic.lookup
44
+ [basic.lookup.argdep]: basic.md#basic.lookup.argdep
45
+ [basic.lookup.classref]: basic.md#basic.lookup.classref
46
+ [basic.lookup.elab]: basic.md#basic.lookup.elab
47
+ [basic.lookup.qual]: basic.md#basic.lookup.qual
48
+ [basic.lookup.udir]: basic.md#basic.lookup.udir
49
+ [basic.lookup.unqual]: basic.md#basic.lookup.unqual
50
+ [basic.namespace]: #basic.namespace
51
+ [basic.scope]: basic.md#basic.scope
52
+ [basic.scope.block]: basic.md#basic.scope.block
53
+ [basic.scope.declarative]: basic.md#basic.scope.declarative
54
+ [basic.scope.namespace]: basic.md#basic.scope.namespace
55
+ [basic.scope.param]: basic.md#basic.scope.param
56
+ [basic.scope.pdecl]: basic.md#basic.scope.pdecl
57
+ [basic.start]: basic.md#basic.start
58
+ [basic.start.dynamic]: basic.md#basic.start.dynamic
59
+ [basic.start.static]: basic.md#basic.start.static
60
+ [basic.stc]: basic.md#basic.stc
61
+ [basic.stc.auto]: basic.md#basic.stc.auto
62
+ [basic.stc.dynamic]: basic.md#basic.stc.dynamic
63
+ [basic.stc.dynamic.allocation]: basic.md#basic.stc.dynamic.allocation
64
+ [basic.stc.dynamic.deallocation]: basic.md#basic.stc.dynamic.deallocation
65
+ [basic.stc.static]: basic.md#basic.stc.static
66
+ [basic.stc.thread]: basic.md#basic.stc.thread
67
+ [basic.type.qualifier]: basic.md#basic.type.qualifier
68
+ [basic.types]: basic.md#basic.types
69
+ [class]: class.md#class
70
+ [class.access]: class.md#class.access
71
+ [class.base.init]: class.md#class.base.init
72
+ [class.bit]: class.md#class.bit
73
+ [class.compare.default]: class.md#class.compare.default
74
+ [class.conv]: class.md#class.conv
75
+ [class.conv.ctor]: class.md#class.conv.ctor
76
+ [class.conv.fct]: class.md#class.conv.fct
77
+ [class.copy.assign]: class.md#class.copy.assign
78
+ [class.copy.ctor]: class.md#class.copy.ctor
79
+ [class.copy.elision]: class.md#class.copy.elision
80
+ [class.ctor]: class.md#class.ctor
81
+ [class.default.ctor]: class.md#class.default.ctor
82
+ [class.dtor]: class.md#class.dtor
83
+ [class.expl.init]: class.md#class.expl.init
84
+ [class.friend]: class.md#class.friend
85
+ [class.inhctor.init]: class.md#class.inhctor.init
86
+ [class.init]: class.md#class.init
87
+ [class.mem]: class.md#class.mem
88
+ [class.member.lookup]: class.md#class.member.lookup
89
+ [class.mfct]: class.md#class.mfct
90
+ [class.mi]: class.md#class.mi
91
+ [class.name]: class.md#class.name
92
+ [class.pre]: class.md#class.pre
93
+ [class.qual]: basic.md#class.qual
94
+ [class.static]: class.md#class.static
95
+ [class.static.data]: class.md#class.static.data
96
+ [class.temporary]: basic.md#class.temporary
97
+ [class.union]: class.md#class.union
98
+ [class.union.anon]: class.md#class.union.anon
99
+ [class.virtual]: class.md#class.virtual
100
+ [conv]: expr.md#conv
101
+ [conv.array]: expr.md#conv.array
102
+ [conv.func]: expr.md#conv.func
103
+ [conv.lval]: expr.md#conv.lval
104
+ [conv.prom]: expr.md#conv.prom
105
+ [conv.ptr]: expr.md#conv.ptr
106
+ [conv.qual]: expr.md#conv.qual
107
+ [conv.rval]: expr.md#conv.rval
108
+ [coroutine.handle]: support.md#coroutine.handle
109
+ [coroutine.handle.resumption]: support.md#coroutine.handle.resumption
110
+ [dcl.align]: #dcl.align
111
+ [dcl.ambig.res]: #dcl.ambig.res
112
+ [dcl.array]: #dcl.array
113
+ [dcl.asm]: #dcl.asm
114
+ [dcl.attr]: #dcl.attr
115
+ [dcl.attr.depend]: #dcl.attr.depend
116
+ [dcl.attr.deprecated]: #dcl.attr.deprecated
117
+ [dcl.attr.fallthrough]: #dcl.attr.fallthrough
118
+ [dcl.attr.grammar]: #dcl.attr.grammar
119
+ [dcl.attr.likelihood]: #dcl.attr.likelihood
120
+ [dcl.attr.nodiscard]: #dcl.attr.nodiscard
121
+ [dcl.attr.noreturn]: #dcl.attr.noreturn
122
+ [dcl.attr.nouniqueaddr]: #dcl.attr.nouniqueaddr
123
+ [dcl.attr.unused]: #dcl.attr.unused
124
+ [dcl.constexpr]: #dcl.constexpr
125
+ [dcl.constinit]: #dcl.constinit
126
+ [dcl.dcl]: #dcl.dcl
127
+ [dcl.decl]: #dcl.decl
128
+ [dcl.enum]: #dcl.enum
129
+ [dcl.fct]: #dcl.fct
130
+ [dcl.fct.def]: #dcl.fct.def
131
+ [dcl.fct.def.coroutine]: #dcl.fct.def.coroutine
132
+ [dcl.fct.def.default]: #dcl.fct.def.default
133
+ [dcl.fct.def.delete]: #dcl.fct.def.delete
134
+ [dcl.fct.def.general]: #dcl.fct.def.general
135
+ [dcl.fct.default]: #dcl.fct.default
136
+ [dcl.fct.spec]: #dcl.fct.spec
137
+ [dcl.friend]: #dcl.friend
138
+ [dcl.init]: #dcl.init
139
+ [dcl.init.aggr]: #dcl.init.aggr
140
+ [dcl.init.list]: #dcl.init.list
141
+ [dcl.init.ref]: #dcl.init.ref
142
+ [dcl.init.string]: #dcl.init.string
143
+ [dcl.inline]: #dcl.inline
144
+ [dcl.link]: #dcl.link
145
+ [dcl.meaning]: #dcl.meaning
146
+ [dcl.mptr]: #dcl.mptr
147
+ [dcl.name]: #dcl.name
148
+ [dcl.pre]: #dcl.pre
149
+ [dcl.ptr]: #dcl.ptr
150
+ [dcl.ref]: #dcl.ref
151
+ [dcl.spec]: #dcl.spec
152
+ [dcl.spec.auto]: #dcl.spec.auto
153
+ [dcl.stc]: #dcl.stc
154
+ [dcl.struct.bind]: #dcl.struct.bind
155
+ [dcl.type]: #dcl.type
156
+ [dcl.type.auto.deduct]: #dcl.type.auto.deduct
157
+ [dcl.type.class.deduct]: #dcl.type.class.deduct
158
+ [dcl.type.cv]: #dcl.type.cv
159
+ [dcl.type.decltype]: #dcl.type.decltype
160
+ [dcl.type.elab]: #dcl.type.elab
161
+ [dcl.type.simple]: #dcl.type.simple
162
+ [dcl.typedef]: #dcl.typedef
163
+ [depr.volatile.type]: future.md#depr.volatile.type
164
+ [enum]: #enum
165
+ [enum.udecl]: #enum.udecl
166
+ [except.ctor]: except.md#except.ctor
167
+ [except.handle]: except.md#except.handle
168
+ [except.spec]: except.md#except.spec
169
+ [except.throw]: except.md#except.throw
170
+ [expr.alignof]: expr.md#expr.alignof
171
+ [expr.ass]: expr.md#expr.ass
172
+ [expr.await]: expr.md#expr.await
173
+ [expr.call]: expr.md#expr.call
174
+ [expr.cast]: expr.md#expr.cast
175
+ [expr.const]: expr.md#expr.const
176
+ [expr.const.cast]: expr.md#expr.const.cast
177
+ [expr.mptr.oper]: expr.md#expr.mptr.oper
178
+ [expr.new]: expr.md#expr.new
179
+ [expr.post.incr]: expr.md#expr.post.incr
180
+ [expr.pre.incr]: expr.md#expr.pre.incr
181
+ [expr.prim.lambda]: expr.md#expr.prim.lambda
182
+ [expr.prim.this]: expr.md#expr.prim.this
183
+ [expr.prop]: expr.md#expr.prop
184
+ [expr.ref]: expr.md#expr.ref
185
+ [expr.static.cast]: expr.md#expr.static.cast
186
+ [expr.sub]: expr.md#expr.sub
187
+ [expr.type.conv]: expr.md#expr.type.conv
188
+ [expr.unary]: expr.md#expr.unary
189
+ [expr.unary.op]: expr.md#expr.unary.op
190
+ [expr.yield]: expr.md#expr.yield
191
+ [intro.compliance]: intro.md#intro.compliance
192
+ [intro.execution]: basic.md#intro.execution
193
+ [intro.multithread]: basic.md#intro.multithread
194
+ [intro.object]: basic.md#intro.object
195
+ [lex.charset]: lex.md#lex.charset
196
+ [lex.digraph]: lex.md#lex.digraph
197
+ [lex.key]: lex.md#lex.key
198
+ [lex.name]: lex.md#lex.name
199
+ [lex.string]: lex.md#lex.string
200
+ [module.interface]: module.md#module.interface
201
+ [namespace.alias]: #namespace.alias
202
+ [namespace.def]: #namespace.def
203
+ [namespace.memdef]: #namespace.memdef
204
+ [namespace.qual]: basic.md#namespace.qual
205
+ [namespace.udecl]: #namespace.udecl
206
+ [namespace.udir]: #namespace.udir
207
+ [namespace.unnamed]: #namespace.unnamed
208
+ [over]: over.md#over
209
+ [over.binary]: over.md#over.binary
210
+ [over.match]: over.md#over.match
211
+ [over.match.best]: over.md#over.match.best
212
+ [over.match.class.deduct]: over.md#over.match.class.deduct
213
+ [over.match.conv]: over.md#over.match.conv
214
+ [over.match.copy]: over.md#over.match.copy
215
+ [over.match.ctor]: over.md#over.match.ctor
216
+ [over.match.funcs]: over.md#over.match.funcs
217
+ [over.match.list]: over.md#over.match.list
218
+ [over.match.ref]: over.md#over.match.ref
219
+ [over.match.viable]: over.md#over.match.viable
220
+ [over.oper]: over.md#over.oper
221
+ [over.sub]: over.md#over.sub
222
+ [special]: class.md#special
223
+ [stmt.ambig]: stmt.md#stmt.ambig
224
+ [stmt.dcl]: stmt.md#stmt.dcl
225
+ [stmt.expr]: stmt.md#stmt.expr
226
+ [stmt.if]: stmt.md#stmt.if
227
+ [stmt.iter]: stmt.md#stmt.iter
228
+ [stmt.label]: stmt.md#stmt.label
229
+ [stmt.pre]: stmt.md#stmt.pre
230
+ [stmt.return]: stmt.md#stmt.return
231
+ [stmt.return.coroutine]: stmt.md#stmt.return.coroutine
232
+ [stmt.select]: stmt.md#stmt.select
233
+ [stmt.stmt]: stmt.md#stmt.stmt
234
+ [stmt.switch]: stmt.md#stmt.switch
235
+ [support.runtime]: support.md#support.runtime
236
+ [temp.arg.type]: temp.md#temp.arg.type
237
+ [temp.class.spec]: temp.md#temp.class.spec
238
+ [temp.deduct]: temp.md#temp.deduct
239
+ [temp.deduct.call]: temp.md#temp.deduct.call
240
+ [temp.deduct.guide]: temp.md#temp.deduct.guide
241
+ [temp.dep]: temp.md#temp.dep
242
+ [temp.expl.spec]: temp.md#temp.expl.spec
243
+ [temp.explicit]: temp.md#temp.explicit
244
+ [temp.fct]: temp.md#temp.fct
245
+ [temp.inst]: temp.md#temp.inst
246
+ [temp.local]: temp.md#temp.local
247
+ [temp.mem]: temp.md#temp.mem
248
+ [temp.names]: temp.md#temp.names
249
+ [temp.over.link]: temp.md#temp.over.link
250
+ [temp.param]: temp.md#temp.param
251
+ [temp.pre]: temp.md#temp.pre
252
+ [temp.res]: temp.md#temp.res
253
+ [temp.spec]: temp.md#temp.spec
254
+ [temp.variadic]: temp.md#temp.variadic
255
+
256
+ [^1]: There is no special provision for a *decl-specifier-seq* that
257
+ lacks a *type-specifier* or that has a *type-specifier* that only
258
+ specifies *cv-qualifier*s. The “implicit int” rule of C is no longer
259
+ supported.
260
+
261
+ [^2]: As indicated by syntax, cv-qualifiers are a significant component
262
+ in function return types.
263
+
264
+ [^3]: One can explicitly disambiguate the parse either by introducing a
265
+ comma (so the ellipsis will be parsed as part of the
266
+ *parameter-declaration-clause*) or by introducing a name for the
267
+ parameter (so the ellipsis will be parsed as part of the
268
+ *declarator-id*).
269
+
270
+ [^4]: This means that default arguments cannot appear, for example, in
271
+ declarations of pointers to functions, references to functions, or
272
+ `typedef` declarations.
273
+
274
+ [^5]: As specified in  [[conv.ptr]], converting an integer literal whose
275
+ value is `0` to a pointer type results in a null pointer value.
276
+
277
+ [^6]: The syntax provides for empty *braced-init-list*s, but nonetheless
278
+ C++ does not have zero length arrays.
279
+
280
+ [^7]: This requires a conversion function [[class.conv.fct]] returning a
281
+ reference type.
282
+
283
+ [^8]: Implementations are permitted to provide additional predefined
284
+ variables with names that are reserved to the implementation
285
+ [[lex.name]]. If a predefined variable is not odr-used
286
+ [[basic.def.odr]], its string value need not be present in the
287
+ program image.
288
+
289
+ [^9]: This set of values is used to define promotion and conversion
290
+ semantics for the enumeration type. It does not preclude an
291
+ expression of enumeration type from having a value that falls
292
+ outside this range.
293
+
294
+ [^10]: this implies that the name of the class or function is
295
+ unqualified.
296
+
297
+ [^11]: During name lookup in a class hierarchy, some ambiguities may be
298
+ resolved by considering whether one member hides the other along
299
+ some paths [[class.member.lookup]]. There is no such disambiguation
300
+ when considering the set of names found as a result of following
301
+ *using-directive*s.
302
+
303
+ [^12]: A *using-declaration* with more than one *using-declarator* is
304
+ equivalent to a corresponding sequence of *using-declaration*s with
305
+ one *using-declarator* each.