- tmp/tmpnvornli_/{from.md → to.md} +504 -90
tmp/tmpnvornli_/{from.md → to.md}
RENAMED
|
@@ -16,17 +16,17 @@ attribute-specifier:
|
|
| 16 |
alignment-specifier
|
| 17 |
```
|
| 18 |
|
| 19 |
``` bnf
|
| 20 |
alignment-specifier:
|
| 21 |
-
|
| 22 |
-
|
| 23 |
```
|
| 24 |
|
| 25 |
``` bnf
|
| 26 |
attribute-using-prefix:
|
| 27 |
-
|
| 28 |
```
|
| 29 |
|
| 30 |
``` bnf
|
| 31 |
attribute-list:
|
| 32 |
attributeₒₚₜ
|
|
@@ -102,45 +102,50 @@ contain an *attribute-scoped-token* and every *attribute-token* in that
|
|
| 102 |
[*Note 2*: For each individual attribute, the form of the
|
| 103 |
*balanced-token-seq* will be specified. — *end note*]
|
| 104 |
|
| 105 |
In an *attribute-list*, an ellipsis may appear only if that
|
| 106 |
*attribute*’s specification permits it. An *attribute* followed by an
|
| 107 |
-
ellipsis is a pack expansion
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
*attribute-argument-clause* (if any).
|
| 117 |
|
| 118 |
Each *attribute-specifier-seq* is said to *appertain* to some entity or
|
| 119 |
-
statement, identified by the syntactic context where it appears (
|
| 120 |
-
[[stmt.stmt]],
|
| 121 |
*attribute-specifier-seq* that appertains to some entity or statement
|
| 122 |
contains an *attribute* or *alignment-specifier* that is not allowed to
|
| 123 |
apply to that entity or statement, the program is ill-formed. If an
|
| 124 |
-
*attribute-specifier-seq* appertains to a friend declaration
|
| 125 |
-
[[class.friend]]
|
| 126 |
-
|
| 127 |
-
[
|
|
|
|
| 128 |
|
| 129 |
For an *attribute-token* (including an *attribute-scoped-token*) not
|
| 130 |
-
specified in this
|
| 131 |
-
|
| 132 |
-
|
| 133 |
|
| 134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
*attribute-namespace* in an *attribute-scoped-token*. — *end note*]
|
| 136 |
|
| 137 |
Two consecutive left square bracket tokens shall appear only when
|
| 138 |
introducing an *attribute-specifier* or within the *balanced-token-seq*
|
| 139 |
of an *attribute-argument-clause*.
|
| 140 |
|
| 141 |
-
[*Note
|
| 142 |
*attribute-specifier* is not allowed, the program is ill-formed even if
|
| 143 |
the brackets match an alternative grammar production. — *end note*]
|
| 144 |
|
| 145 |
[*Example 2*:
|
| 146 |
|
|
@@ -159,30 +164,27 @@ void f() {
|
|
| 159 |
|
| 160 |
### Alignment specifier <a id="dcl.align">[[dcl.align]]</a>
|
| 161 |
|
| 162 |
An *alignment-specifier* may be applied to a variable or to a class data
|
| 163 |
member, but it shall not be applied to a bit-field, a function
|
| 164 |
-
parameter, or an *exception-declaration*
|
| 165 |
-
*alignment-specifier* may also be applied to the declaration
|
| 166 |
-
|
| 167 |
-
[[
|
| 168 |
-
|
| 169 |
-
*opaque-enum-declaration* or *enum-head*, respectively ([[dcl.enum]])).
|
| 170 |
-
An *alignment-specifier* with an ellipsis is a pack expansion (
|
| 171 |
-
[[temp.variadic]]).
|
| 172 |
|
| 173 |
When the *alignment-specifier* is of the form `alignas(`
|
| 174 |
*constant-expression* `)`:
|
| 175 |
|
| 176 |
- the *constant-expression* shall be an integral constant expression
|
| 177 |
-
- if the constant expression does not evaluate to an alignment value
|
| 178 |
-
[[basic.align]]
|
| 179 |
implementation does not support that alignment in the context of the
|
| 180 |
declaration, the program is ill-formed.
|
| 181 |
|
| 182 |
An *alignment-specifier* of the form `alignas(` *type-id* `)` has the
|
| 183 |
-
same effect as `alignas({}alignof(` *type-id* `))`
|
| 184 |
|
| 185 |
The alignment requirement of an entity is the strictest nonzero
|
| 186 |
alignment specified by its *alignment-specifier*s, if any; otherwise,
|
| 187 |
the *alignment-specifier*s have no effect.
|
| 188 |
|
|
@@ -215,11 +217,11 @@ different *alignment-specifier*s in different translation units.
|
|
| 215 |
``` cpp
|
| 216 |
// Translation unit #1:
|
| 217 |
struct S { int x; } s, *p = &s;
|
| 218 |
|
| 219 |
// Translation unit #2:
|
| 220 |
-
struct alignas(16) S; //
|
| 221 |
extern S* p;
|
| 222 |
```
|
| 223 |
|
| 224 |
— *end example*]
|
| 225 |
|
|
@@ -256,15 +258,15 @@ The *attribute-token* `carries_dependency` specifies dependency
|
|
| 256 |
propagation into and out of functions. It shall appear at most once in
|
| 257 |
each *attribute-list* and no *attribute-argument-clause* shall be
|
| 258 |
present. The attribute may be applied to the *declarator-id* of a
|
| 259 |
*parameter-declaration* in a function declaration or lambda, in which
|
| 260 |
case it specifies that the initialization of the parameter carries a
|
| 261 |
-
dependency to
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
|
| 267 |
The first declaration of a function shall specify the
|
| 268 |
`carries_dependency` attribute for its *declarator-id* if any
|
| 269 |
declaration of the function specifies the `carries_dependency`
|
| 270 |
attribute. Furthermore, the first declaration of a function shall
|
|
@@ -289,11 +291,11 @@ code. — *end note*]
|
|
| 289 |
struct foo { int* a; int* b; };
|
| 290 |
std::atomic<struct foo *> foo_head[10];
|
| 291 |
int foo_array[10][10];
|
| 292 |
|
| 293 |
[[carries_dependency]] struct foo* f(int i) {
|
| 294 |
-
return foo_head[i].load(
|
| 295 |
}
|
| 296 |
|
| 297 |
int g(int* x, int* y [[carries_dependency]]) {
|
| 298 |
return kill_dependency(foo_array[*x][*y]);
|
| 299 |
}
|
|
@@ -316,17 +318,15 @@ void h(int i) {
|
|
| 316 |
|
| 317 |
The `carries_dependency` attribute on function `f` means that the return
|
| 318 |
value carries a dependency out of `f`, so that the implementation need
|
| 319 |
not constrain ordering upon return from `f`. Implementations of `f` and
|
| 320 |
its caller may choose to preserve dependencies instead of emitting
|
| 321 |
-
hardware memory ordering instructions (a.k.a.
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
but its
|
| 325 |
-
|
| 326 |
-
implementation might need to insert a fence prior to the second call to
|
| 327 |
-
`g`.
|
| 328 |
|
| 329 |
— *end example*]
|
| 330 |
|
| 331 |
### Deprecated attribute <a id="dcl.attr.deprecated">[[dcl.attr.deprecated]]</a>
|
| 332 |
|
|
@@ -338,12 +338,12 @@ entities that are deemed obsolescent or unsafe. — *end note*]
|
|
| 338 |
|
| 339 |
It shall appear at most once in each *attribute-list*. An
|
| 340 |
*attribute-argument-clause* may be present and, if present, it shall
|
| 341 |
have the form:
|
| 342 |
|
| 343 |
-
```
|
| 344 |
-
( string-literal )
|
| 345 |
```
|
| 346 |
|
| 347 |
[*Note 2*: The *string-literal* in the *attribute-argument-clause*
|
| 348 |
could be used to explain the rationale for deprecation and/or to suggest
|
| 349 |
a replacing entity. — *end note*]
|
|
@@ -362,35 +362,37 @@ the entity. — *end note*]
|
|
| 362 |
|
| 363 |
Redeclarations using different forms of the attribute (with or without
|
| 364 |
the *attribute-argument-clause* or with different
|
| 365 |
*attribute-argument-clause*s) are allowed.
|
| 366 |
|
| 367 |
-
|
| 368 |
-
produce a diagnostic message in case the program refers to
|
| 369 |
-
entity other than to declare it, after a declaration that
|
| 370 |
-
attribute. The diagnostic message
|
| 371 |
-
the *attribute-argument-clause* of any `deprecated`
|
| 372 |
-
the name or entity.
|
| 373 |
|
| 374 |
### Fallthrough attribute <a id="dcl.attr.fallthrough">[[dcl.attr.fallthrough]]</a>
|
| 375 |
|
| 376 |
-
The *attribute-token* `fallthrough` may be applied to a null statement
|
| 377 |
-
[[stmt.expr]]
|
| 378 |
*attribute-token* `fallthrough` shall appear at most once in each
|
| 379 |
*attribute-list* and no *attribute-argument-clause* shall be present. A
|
| 380 |
fallthrough statement may only appear within an enclosing `switch`
|
| 381 |
-
statement
|
| 382 |
after a fallthrough statement shall be a labeled statement whose label
|
| 383 |
-
is a case label or default label for the same `switch` statement
|
| 384 |
-
|
|
|
|
|
|
|
|
|
|
| 385 |
|
| 386 |
-
|
| 387 |
-
warning that an implementation might otherwise issue for a
|
| 388 |
-
default label that is reachable from another case or default
|
| 389 |
-
some path of execution. Implementations
|
| 390 |
-
warning if a fallthrough statement is not dynamically
|
| 391 |
-
reachable. — *end note*]
|
| 392 |
|
| 393 |
[*Example 1*:
|
| 394 |
|
| 395 |
``` cpp
|
| 396 |
void f(int n) {
|
|
@@ -399,76 +401,183 @@ void f(int n) {
|
|
| 399 |
case 1:
|
| 400 |
case 2:
|
| 401 |
g();
|
| 402 |
[[fallthrough]];
|
| 403 |
case 3: // warning on fallthrough discouraged
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 404 |
h();
|
| 405 |
case 4: // implementation may warn on fallthrough
|
| 406 |
i();
|
| 407 |
-
[[fallthrough]]; //
|
| 408 |
}
|
| 409 |
}
|
| 410 |
```
|
| 411 |
|
| 412 |
— *end example*]
|
| 413 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 414 |
### Maybe unused attribute <a id="dcl.attr.unused">[[dcl.attr.unused]]</a>
|
| 415 |
|
| 416 |
The *attribute-token* `maybe_unused` indicates that a name or entity is
|
| 417 |
possibly intentionally unused. It shall appear at most once in each
|
| 418 |
*attribute-list* and no *attribute-argument-clause* shall be present.
|
| 419 |
|
| 420 |
The attribute may be applied to the declaration of a class, a
|
| 421 |
-
*typedef-name*, a variable
|
| 422 |
-
enumeration, or an enumerator.
|
| 423 |
-
|
| 424 |
-
[*Note 1*: For an entity marked `maybe_unused`, implementations are
|
| 425 |
-
encouraged not to emit a warning that the entity is unused, or that the
|
| 426 |
-
entity is used despite the presence of the attribute. — *end note*]
|
| 427 |
|
| 428 |
A name or entity declared without the `maybe_unused` attribute can later
|
| 429 |
be redeclared with the attribute and vice versa. An entity is considered
|
| 430 |
marked after the first declaration that marks it.
|
| 431 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 432 |
[*Example 1*:
|
| 433 |
|
| 434 |
``` cpp
|
| 435 |
[[maybe_unused]] void f([[maybe_unused]] bool thing1,
|
| 436 |
[[maybe_unused]] bool thing2) {
|
| 437 |
[[maybe_unused]] bool b = thing1 && thing2;
|
| 438 |
assert(b);
|
| 439 |
}
|
| 440 |
```
|
| 441 |
|
| 442 |
-
Implementations
|
| 443 |
-
|
| 444 |
|
| 445 |
— *end example*]
|
| 446 |
|
| 447 |
### Nodiscard attribute <a id="dcl.attr.nodiscard">[[dcl.attr.nodiscard]]</a>
|
| 448 |
|
| 449 |
The *attribute-token* `nodiscard` may be applied to the *declarator-id*
|
| 450 |
in a function declaration or to the declaration of a class or
|
| 451 |
-
enumeration. It shall appear at most once in each *attribute-list*
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 462 |
|
| 463 |
[*Example 1*:
|
| 464 |
|
| 465 |
``` cpp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 466 |
struct [[nodiscard]] error_info { ... };
|
| 467 |
error_info enable_missile_safety_mode();
|
| 468 |
void launch_missiles();
|
| 469 |
void test_missiles() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 470 |
enable_missile_safety_mode(); // warning encouraged
|
| 471 |
launch_missiles();
|
| 472 |
}
|
| 473 |
error_info &foo();
|
| 474 |
void f() { foo(); } // warning not encouraged: not a nodiscard call, because neither
|
|
@@ -495,12 +604,12 @@ If a function `f` is called where `f` was previously declared with the
|
|
| 495 |
undefined.
|
| 496 |
|
| 497 |
[*Note 1*: The function may terminate by throwing an
|
| 498 |
exception. — *end note*]
|
| 499 |
|
| 500 |
-
|
| 501 |
-
function marked `[[noreturn]]` might return.
|
| 502 |
|
| 503 |
[*Example 1*:
|
| 504 |
|
| 505 |
``` cpp
|
| 506 |
[[ noreturn ]] void f() {
|
|
@@ -513,5 +622,310 @@ function marked `[[noreturn]]` might return. — *end note*]
|
|
| 513 |
}
|
| 514 |
```
|
| 515 |
|
| 516 |
— *end example*]
|
| 517 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
alignment-specifier
|
| 17 |
```
|
| 18 |
|
| 19 |
``` bnf
|
| 20 |
alignment-specifier:
|
| 21 |
+
alignas '(' type-id '...'ₒₚₜ ')'
|
| 22 |
+
alignas '(' constant-expression '...'ₒₚₜ ')'
|
| 23 |
```
|
| 24 |
|
| 25 |
``` bnf
|
| 26 |
attribute-using-prefix:
|
| 27 |
+
using attribute-namespace ':'
|
| 28 |
```
|
| 29 |
|
| 30 |
``` bnf
|
| 31 |
attribute-list:
|
| 32 |
attributeₒₚₜ
|
|
|
|
| 102 |
[*Note 2*: For each individual attribute, the form of the
|
| 103 |
*balanced-token-seq* will be specified. — *end note*]
|
| 104 |
|
| 105 |
In an *attribute-list*, an ellipsis may appear only if that
|
| 106 |
*attribute*’s specification permits it. An *attribute* followed by an
|
| 107 |
+
ellipsis is a pack expansion [[temp.variadic]]. An *attribute-specifier*
|
| 108 |
+
that contains no *attribute*s has no effect. The order in which the
|
| 109 |
+
*attribute-token*s appear in an *attribute-list* is not significant. If
|
| 110 |
+
a keyword [[lex.key]] or an alternative token [[lex.digraph]] that
|
| 111 |
+
satisfies the syntactic requirements of an *identifier* [[lex.name]] is
|
| 112 |
+
contained in an *attribute-token*, it is considered an identifier. No
|
| 113 |
+
name lookup [[basic.lookup]] is performed on any of the identifiers
|
| 114 |
+
contained in an *attribute-token*. The *attribute-token* determines
|
| 115 |
+
additional requirements on the *attribute-argument-clause* (if any).
|
|
|
|
| 116 |
|
| 117 |
Each *attribute-specifier-seq* is said to *appertain* to some entity or
|
| 118 |
+
statement, identified by the syntactic context where it appears (
|
| 119 |
+
[[stmt.stmt]], [[dcl.dcl]], [[dcl.decl]]). If an
|
| 120 |
*attribute-specifier-seq* that appertains to some entity or statement
|
| 121 |
contains an *attribute* or *alignment-specifier* that is not allowed to
|
| 122 |
apply to that entity or statement, the program is ill-formed. If an
|
| 123 |
+
*attribute-specifier-seq* appertains to a friend declaration
|
| 124 |
+
[[class.friend]], that declaration shall be a definition.
|
| 125 |
+
|
| 126 |
+
[*Note 3*: An *attribute-specifier-seq* cannot appeartain to an
|
| 127 |
+
explicit instantiation [[temp.explicit]]. — *end note*]
|
| 128 |
|
| 129 |
For an *attribute-token* (including an *attribute-scoped-token*) not
|
| 130 |
+
specified in this document, the behavior is *implementation-defined*.
|
| 131 |
+
Any *attribute-token* that is not recognized by the implementation is
|
| 132 |
+
ignored. An *attribute-token* is reserved for future standardization if
|
| 133 |
|
| 134 |
+
- it is not an *attribute-scoped-token* and is not specified in this
|
| 135 |
+
document, or
|
| 136 |
+
- it is an *attribute-scoped-token* and its *attribute-namespace* is
|
| 137 |
+
`std` followed by zero or more digits.
|
| 138 |
+
|
| 139 |
+
[*Note 4*: Each implementation should choose a distinctive name for the
|
| 140 |
*attribute-namespace* in an *attribute-scoped-token*. — *end note*]
|
| 141 |
|
| 142 |
Two consecutive left square bracket tokens shall appear only when
|
| 143 |
introducing an *attribute-specifier* or within the *balanced-token-seq*
|
| 144 |
of an *attribute-argument-clause*.
|
| 145 |
|
| 146 |
+
[*Note 5*: If two consecutive left square brackets appear where an
|
| 147 |
*attribute-specifier* is not allowed, the program is ill-formed even if
|
| 148 |
the brackets match an alternative grammar production. — *end note*]
|
| 149 |
|
| 150 |
[*Example 2*:
|
| 151 |
|
|
|
|
| 164 |
|
| 165 |
### Alignment specifier <a id="dcl.align">[[dcl.align]]</a>
|
| 166 |
|
| 167 |
An *alignment-specifier* may be applied to a variable or to a class data
|
| 168 |
member, but it shall not be applied to a bit-field, a function
|
| 169 |
+
parameter, or an *exception-declaration* [[except.handle]]. An
|
| 170 |
+
*alignment-specifier* may also be applied to the declaration of a class
|
| 171 |
+
(in an *elaborated-type-specifier* [[dcl.type.elab]] or *class-head*
|
| 172 |
+
[[class]], respectively). An *alignment-specifier* with an ellipsis is a
|
| 173 |
+
pack expansion [[temp.variadic]].
|
|
|
|
|
|
|
|
|
|
| 174 |
|
| 175 |
When the *alignment-specifier* is of the form `alignas(`
|
| 176 |
*constant-expression* `)`:
|
| 177 |
|
| 178 |
- the *constant-expression* shall be an integral constant expression
|
| 179 |
+
- if the constant expression does not evaluate to an alignment value
|
| 180 |
+
[[basic.align]], or evaluates to an extended alignment and the
|
| 181 |
implementation does not support that alignment in the context of the
|
| 182 |
declaration, the program is ill-formed.
|
| 183 |
|
| 184 |
An *alignment-specifier* of the form `alignas(` *type-id* `)` has the
|
| 185 |
+
same effect as `alignas({}alignof(` *type-id* `))` [[expr.alignof]].
|
| 186 |
|
| 187 |
The alignment requirement of an entity is the strictest nonzero
|
| 188 |
alignment specified by its *alignment-specifier*s, if any; otherwise,
|
| 189 |
the *alignment-specifier*s have no effect.
|
| 190 |
|
|
|
|
| 217 |
``` cpp
|
| 218 |
// Translation unit #1:
|
| 219 |
struct S { int x; } s, *p = &s;
|
| 220 |
|
| 221 |
// Translation unit #2:
|
| 222 |
+
struct alignas(16) S; // ill-formed, no diagnostic required: definition of S lacks alignment
|
| 223 |
extern S* p;
|
| 224 |
```
|
| 225 |
|
| 226 |
— *end example*]
|
| 227 |
|
|
|
|
| 258 |
propagation into and out of functions. It shall appear at most once in
|
| 259 |
each *attribute-list* and no *attribute-argument-clause* shall be
|
| 260 |
present. The attribute may be applied to the *declarator-id* of a
|
| 261 |
*parameter-declaration* in a function declaration or lambda, in which
|
| 262 |
case it specifies that the initialization of the parameter carries a
|
| 263 |
+
dependency to [[intro.multithread]] each lvalue-to-rvalue conversion
|
| 264 |
+
[[conv.lval]] of that object. The attribute may also be applied to the
|
| 265 |
+
*declarator-id* of a function declaration, in which case it specifies
|
| 266 |
+
that the return value, if any, carries a dependency to the evaluation of
|
| 267 |
+
the function call expression.
|
| 268 |
|
| 269 |
The first declaration of a function shall specify the
|
| 270 |
`carries_dependency` attribute for its *declarator-id* if any
|
| 271 |
declaration of the function specifies the `carries_dependency`
|
| 272 |
attribute. Furthermore, the first declaration of a function shall
|
|
|
|
| 291 |
struct foo { int* a; int* b; };
|
| 292 |
std::atomic<struct foo *> foo_head[10];
|
| 293 |
int foo_array[10][10];
|
| 294 |
|
| 295 |
[[carries_dependency]] struct foo* f(int i) {
|
| 296 |
+
return foo_head[i].load(memory_order::consume);
|
| 297 |
}
|
| 298 |
|
| 299 |
int g(int* x, int* y [[carries_dependency]]) {
|
| 300 |
return kill_dependency(foo_array[*x][*y]);
|
| 301 |
}
|
|
|
|
| 318 |
|
| 319 |
The `carries_dependency` attribute on function `f` means that the return
|
| 320 |
value carries a dependency out of `f`, so that the implementation need
|
| 321 |
not constrain ordering upon return from `f`. Implementations of `f` and
|
| 322 |
its caller may choose to preserve dependencies instead of emitting
|
| 323 |
+
hardware memory ordering instructions (a.k.a. fences). Function `g`’s
|
| 324 |
+
second parameter has a `carries_dependency` attribute, but its first
|
| 325 |
+
parameter does not. Therefore, function `h`’s first call to `g` carries
|
| 326 |
+
a dependency into `g`, but its second call does not. The implementation
|
| 327 |
+
might need to insert a fence prior to the second call to `g`.
|
|
|
|
|
|
|
| 328 |
|
| 329 |
— *end example*]
|
| 330 |
|
| 331 |
### Deprecated attribute <a id="dcl.attr.deprecated">[[dcl.attr.deprecated]]</a>
|
| 332 |
|
|
|
|
| 338 |
|
| 339 |
It shall appear at most once in each *attribute-list*. An
|
| 340 |
*attribute-argument-clause* may be present and, if present, it shall
|
| 341 |
have the form:
|
| 342 |
|
| 343 |
+
``` bnf
|
| 344 |
+
'(' string-literal ')'
|
| 345 |
```
|
| 346 |
|
| 347 |
[*Note 2*: The *string-literal* in the *attribute-argument-clause*
|
| 348 |
could be used to explain the rationale for deprecation and/or to suggest
|
| 349 |
a replacing entity. — *end note*]
|
|
|
|
| 362 |
|
| 363 |
Redeclarations using different forms of the attribute (with or without
|
| 364 |
the *attribute-argument-clause* or with different
|
| 365 |
*attribute-argument-clause*s) are allowed.
|
| 366 |
|
| 367 |
+
*Recommended practice:* Implementations should use the `deprecated`
|
| 368 |
+
attribute to produce a diagnostic message in case the program refers to
|
| 369 |
+
a name or entity other than to declare it, after a declaration that
|
| 370 |
+
specifies the attribute. The diagnostic message should include the text
|
| 371 |
+
provided within the *attribute-argument-clause* of any `deprecated`
|
| 372 |
+
attribute applied to the name or entity.
|
| 373 |
|
| 374 |
### Fallthrough attribute <a id="dcl.attr.fallthrough">[[dcl.attr.fallthrough]]</a>
|
| 375 |
|
| 376 |
+
The *attribute-token* `fallthrough` may be applied to a null statement
|
| 377 |
+
[[stmt.expr]]; such a statement is a fallthrough statement. The
|
| 378 |
*attribute-token* `fallthrough` shall appear at most once in each
|
| 379 |
*attribute-list* and no *attribute-argument-clause* shall be present. A
|
| 380 |
fallthrough statement may only appear within an enclosing `switch`
|
| 381 |
+
statement [[stmt.switch]]. The next statement that would be executed
|
| 382 |
after a fallthrough statement shall be a labeled statement whose label
|
| 383 |
+
is a case label or default label for the same `switch` statement and, if
|
| 384 |
+
the fallthrough statement is contained in an iteration statement, the
|
| 385 |
+
next statement shall be part of the same execution of the substatement
|
| 386 |
+
of the innermost enclosing iteration statement. The program is
|
| 387 |
+
ill-formed if there is no such statement.
|
| 388 |
|
| 389 |
+
*Recommended practice:* The use of a fallthrough statement should
|
| 390 |
+
suppress a warning that an implementation might otherwise issue for a
|
| 391 |
+
case or default label that is reachable from another case or default
|
| 392 |
+
label along some path of execution. Implementations should issue a
|
| 393 |
+
warning if a fallthrough statement is not dynamically reachable.
|
|
|
|
| 394 |
|
| 395 |
[*Example 1*:
|
| 396 |
|
| 397 |
``` cpp
|
| 398 |
void f(int n) {
|
|
|
|
| 401 |
case 1:
|
| 402 |
case 2:
|
| 403 |
g();
|
| 404 |
[[fallthrough]];
|
| 405 |
case 3: // warning on fallthrough discouraged
|
| 406 |
+
do {
|
| 407 |
+
[[fallthrough]]; // error: next statement is not part of the same substatement execution
|
| 408 |
+
} while (false);
|
| 409 |
+
case 6:
|
| 410 |
+
do {
|
| 411 |
+
[[fallthrough]]; // error: next statement is not part of the same substatement execution
|
| 412 |
+
} while (n--);
|
| 413 |
+
case 7:
|
| 414 |
+
while (false) {
|
| 415 |
+
[[fallthrough]]; // error: next statement is not part of the same substatement execution
|
| 416 |
+
}
|
| 417 |
+
case 5:
|
| 418 |
h();
|
| 419 |
case 4: // implementation may warn on fallthrough
|
| 420 |
i();
|
| 421 |
+
[[fallthrough]]; // error
|
| 422 |
}
|
| 423 |
}
|
| 424 |
```
|
| 425 |
|
| 426 |
— *end example*]
|
| 427 |
|
| 428 |
+
### Likelihood attributes <a id="dcl.attr.likelihood">[[dcl.attr.likelihood]]</a>
|
| 429 |
+
|
| 430 |
+
The *attribute-token*s `likely` and `unlikely` may be applied to labels
|
| 431 |
+
or statements. The *attribute-token*s `likely` and `unlikely` shall
|
| 432 |
+
appear at most once in each *attribute-list* and no
|
| 433 |
+
*attribute-argument-clause* shall be present. The *attribute-token*
|
| 434 |
+
`likely` shall not appear in an *attribute-specifier-seq* that contains
|
| 435 |
+
the *attribute-token* `unlikely`.
|
| 436 |
+
|
| 437 |
+
*Recommended practice:* The use of the `likely` attribute is intended to
|
| 438 |
+
allow implementations to optimize for the case where paths of execution
|
| 439 |
+
including it are arbitrarily more likely than any alternative path of
|
| 440 |
+
execution that does not include such an attribute on a statement or
|
| 441 |
+
label. The use of the `unlikely` attribute is intended to allow
|
| 442 |
+
implementations to optimize for the case where paths of execution
|
| 443 |
+
including it are arbitrarily more unlikely than any alternative path of
|
| 444 |
+
execution that does not include such an attribute on a statement or
|
| 445 |
+
label. A path of execution includes a label if and only if it contains a
|
| 446 |
+
jump to that label.
|
| 447 |
+
|
| 448 |
+
[*Note 1*: Excessive usage of either of these attributes is liable to
|
| 449 |
+
result in performance degradation. — *end note*]
|
| 450 |
+
|
| 451 |
+
[*Example 1*:
|
| 452 |
+
|
| 453 |
+
``` cpp
|
| 454 |
+
void g(int);
|
| 455 |
+
int f(int n) {
|
| 456 |
+
if (n > 5) [[unlikely]] { // n > 5 is considered to be arbitrarily unlikely
|
| 457 |
+
g(0);
|
| 458 |
+
return n * 2 + 1;
|
| 459 |
+
}
|
| 460 |
+
|
| 461 |
+
switch (n) {
|
| 462 |
+
case 1:
|
| 463 |
+
g(1);
|
| 464 |
+
[[fallthrough]];
|
| 465 |
+
|
| 466 |
+
[[likely]] case 2: // n == 2 is considered to be arbitrarily more
|
| 467 |
+
g(2); // likely than any other value of n
|
| 468 |
+
break;
|
| 469 |
+
}
|
| 470 |
+
return 3;
|
| 471 |
+
}
|
| 472 |
+
```
|
| 473 |
+
|
| 474 |
+
— *end example*]
|
| 475 |
+
|
| 476 |
### Maybe unused attribute <a id="dcl.attr.unused">[[dcl.attr.unused]]</a>
|
| 477 |
|
| 478 |
The *attribute-token* `maybe_unused` indicates that a name or entity is
|
| 479 |
possibly intentionally unused. It shall appear at most once in each
|
| 480 |
*attribute-list* and no *attribute-argument-clause* shall be present.
|
| 481 |
|
| 482 |
The attribute may be applied to the declaration of a class, a
|
| 483 |
+
*typedef-name*, a variable (including a structured binding declaration),
|
| 484 |
+
a non-static data member, a function, an enumeration, or an enumerator.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 485 |
|
| 486 |
A name or entity declared without the `maybe_unused` attribute can later
|
| 487 |
be redeclared with the attribute and vice versa. An entity is considered
|
| 488 |
marked after the first declaration that marks it.
|
| 489 |
|
| 490 |
+
*Recommended practice:* For an entity marked `maybe_unused`,
|
| 491 |
+
implementations should not emit a warning that the entity or its
|
| 492 |
+
structured bindings (if any) are used or unused. For a structured
|
| 493 |
+
binding declaration not marked `maybe_unused`, implementations should
|
| 494 |
+
not emit such a warning unless all of its structured bindings are
|
| 495 |
+
unused.
|
| 496 |
+
|
| 497 |
[*Example 1*:
|
| 498 |
|
| 499 |
``` cpp
|
| 500 |
[[maybe_unused]] void f([[maybe_unused]] bool thing1,
|
| 501 |
[[maybe_unused]] bool thing2) {
|
| 502 |
[[maybe_unused]] bool b = thing1 && thing2;
|
| 503 |
assert(b);
|
| 504 |
}
|
| 505 |
```
|
| 506 |
|
| 507 |
+
Implementations should not warn that `b` is unused, whether or not
|
| 508 |
+
`NDEBUG` is defined.
|
| 509 |
|
| 510 |
— *end example*]
|
| 511 |
|
| 512 |
### Nodiscard attribute <a id="dcl.attr.nodiscard">[[dcl.attr.nodiscard]]</a>
|
| 513 |
|
| 514 |
The *attribute-token* `nodiscard` may be applied to the *declarator-id*
|
| 515 |
in a function declaration or to the declaration of a class or
|
| 516 |
+
enumeration. It shall appear at most once in each *attribute-list*. An
|
| 517 |
+
*attribute-argument-clause* may be present and, if present, shall have
|
| 518 |
+
the form:
|
| 519 |
+
|
| 520 |
+
``` bnf
|
| 521 |
+
'(' string-literal ')'
|
| 522 |
+
```
|
| 523 |
+
|
| 524 |
+
A name or entity declared without the `nodiscard` attribute can later be
|
| 525 |
+
redeclared with the attribute and vice-versa.
|
| 526 |
+
|
| 527 |
+
[*Note 1*: Thus, an entity initially declared without the attribute can
|
| 528 |
+
be marked as `nodiscard` by a subsequent redeclaration. However, after
|
| 529 |
+
an entity is marked as `nodiscard`, later redeclarations do not remove
|
| 530 |
+
the `nodiscard` from the entity. — *end note*]
|
| 531 |
+
|
| 532 |
+
Redeclarations using different forms of the attribute (with or without
|
| 533 |
+
the *attribute-argument-clause* or with different
|
| 534 |
+
*attribute-argument-clause*s) are allowed.
|
| 535 |
+
|
| 536 |
+
A *nodiscard type* is a (possibly cv-qualified) class or enumeration
|
| 537 |
+
type marked `nodiscard` in a reachable declaration. A *nodiscard call*
|
| 538 |
+
is either
|
| 539 |
+
|
| 540 |
+
- a function call expression [[expr.call]] that calls a function
|
| 541 |
+
declared `nodiscard` in a reachable declaration or whose return type
|
| 542 |
+
is a nodiscard type, or
|
| 543 |
+
- an explicit type conversion ([[expr.type.conv]],
|
| 544 |
+
[[expr.static.cast]], [[expr.cast]]) that constructs an object through
|
| 545 |
+
a constructor declared `nodiscard` in a reachable declaration, or that
|
| 546 |
+
initializes an object of a nodiscard type.
|
| 547 |
+
|
| 548 |
+
*Recommended practice:* Appearance of a nodiscard call as a
|
| 549 |
+
potentially-evaluated discarded-value expression [[expr.prop]] is
|
| 550 |
+
discouraged unless explicitly cast to `void`. Implementations should
|
| 551 |
+
issue a warning in such cases.
|
| 552 |
+
|
| 553 |
+
[*Note 2*: This is typically because discarding the return value of a
|
| 554 |
+
nodiscard call has surprising consequences. — *end note*]
|
| 555 |
+
|
| 556 |
+
The *string-literal* in a `nodiscard` *attribute-argument-clause* should
|
| 557 |
+
be used in the message of the warning as the rationale for why the
|
| 558 |
+
result should not be discarded.
|
| 559 |
|
| 560 |
[*Example 1*:
|
| 561 |
|
| 562 |
``` cpp
|
| 563 |
+
struct [[nodiscard]] my_scopeguard { ... };
|
| 564 |
+
struct my_unique {
|
| 565 |
+
my_unique() = default; // does not acquire resource
|
| 566 |
+
[[nodiscard]] my_unique(int fd) { ... } // acquires resource
|
| 567 |
+
~my_unique() noexcept { ... } // releases resource, if any
|
| 568 |
+
...
|
| 569 |
+
};
|
| 570 |
struct [[nodiscard]] error_info { ... };
|
| 571 |
error_info enable_missile_safety_mode();
|
| 572 |
void launch_missiles();
|
| 573 |
void test_missiles() {
|
| 574 |
+
my_scopeguard(); // warning encouraged
|
| 575 |
+
(void)my_scopeguard(), // warning not encouraged, cast to void
|
| 576 |
+
launch_missiles(); // comma operator, statement continues
|
| 577 |
+
my_unique(42); // warning encouraged
|
| 578 |
+
my_unique(); // warning not encouraged
|
| 579 |
enable_missile_safety_mode(); // warning encouraged
|
| 580 |
launch_missiles();
|
| 581 |
}
|
| 582 |
error_info &foo();
|
| 583 |
void f() { foo(); } // warning not encouraged: not a nodiscard call, because neither
|
|
|
|
| 604 |
undefined.
|
| 605 |
|
| 606 |
[*Note 1*: The function may terminate by throwing an
|
| 607 |
exception. — *end note*]
|
| 608 |
|
| 609 |
+
*Recommended practice:* Implementations should issue a warning if a
|
| 610 |
+
function marked `[[noreturn]]` might return.
|
| 611 |
|
| 612 |
[*Example 1*:
|
| 613 |
|
| 614 |
``` cpp
|
| 615 |
[[ noreturn ]] void f() {
|
|
|
|
| 622 |
}
|
| 623 |
```
|
| 624 |
|
| 625 |
— *end example*]
|
| 626 |
|
| 627 |
+
### No unique address attribute <a id="dcl.attr.nouniqueaddr">[[dcl.attr.nouniqueaddr]]</a>
|
| 628 |
+
|
| 629 |
+
The *attribute-token* `no_unique_address` specifies that a non-static
|
| 630 |
+
data member is a potentially-overlapping subobject [[intro.object]]. It
|
| 631 |
+
shall appear at most once in each *attribute-list* and no
|
| 632 |
+
*attribute-argument-clause* shall be present. The attribute may
|
| 633 |
+
appertain to a non-static data member other than a bit-field.
|
| 634 |
+
|
| 635 |
+
[*Note 1*: The non-static data member can share the address of another
|
| 636 |
+
non-static data member or that of a base class, and any padding that
|
| 637 |
+
would normally be inserted at the end of the object can be reused as
|
| 638 |
+
storage for other members. — *end note*]
|
| 639 |
+
|
| 640 |
+
[*Example 1*:
|
| 641 |
+
|
| 642 |
+
``` cpp
|
| 643 |
+
template<typename Key, typename Value,
|
| 644 |
+
typename Hash, typename Pred, typename Allocator>
|
| 645 |
+
class hash_map {
|
| 646 |
+
[[no_unique_address]] Hash hasher;
|
| 647 |
+
[[no_unique_address]] Pred pred;
|
| 648 |
+
[[no_unique_address]] Allocator alloc;
|
| 649 |
+
Bucket *buckets;
|
| 650 |
+
// ...
|
| 651 |
+
public:
|
| 652 |
+
// ...
|
| 653 |
+
};
|
| 654 |
+
```
|
| 655 |
+
|
| 656 |
+
Here, `hasher`, `pred`, and `alloc` could have the same address as
|
| 657 |
+
`buckets` if their respective types are all empty.
|
| 658 |
+
|
| 659 |
+
— *end example*]
|
| 660 |
+
|
| 661 |
+
<!-- Link reference definitions -->
|
| 662 |
+
[basic.align]: basic.md#basic.align
|
| 663 |
+
[basic.compound]: basic.md#basic.compound
|
| 664 |
+
[basic.def]: basic.md#basic.def
|
| 665 |
+
[basic.def.odr]: basic.md#basic.def.odr
|
| 666 |
+
[basic.fundamental]: basic.md#basic.fundamental
|
| 667 |
+
[basic.life]: basic.md#basic.life
|
| 668 |
+
[basic.link]: basic.md#basic.link
|
| 669 |
+
[basic.lookup]: basic.md#basic.lookup
|
| 670 |
+
[basic.lookup.argdep]: basic.md#basic.lookup.argdep
|
| 671 |
+
[basic.lookup.classref]: basic.md#basic.lookup.classref
|
| 672 |
+
[basic.lookup.elab]: basic.md#basic.lookup.elab
|
| 673 |
+
[basic.lookup.qual]: basic.md#basic.lookup.qual
|
| 674 |
+
[basic.lookup.udir]: basic.md#basic.lookup.udir
|
| 675 |
+
[basic.lookup.unqual]: basic.md#basic.lookup.unqual
|
| 676 |
+
[basic.namespace]: #basic.namespace
|
| 677 |
+
[basic.scope]: basic.md#basic.scope
|
| 678 |
+
[basic.scope.block]: basic.md#basic.scope.block
|
| 679 |
+
[basic.scope.declarative]: basic.md#basic.scope.declarative
|
| 680 |
+
[basic.scope.namespace]: basic.md#basic.scope.namespace
|
| 681 |
+
[basic.scope.param]: basic.md#basic.scope.param
|
| 682 |
+
[basic.scope.pdecl]: basic.md#basic.scope.pdecl
|
| 683 |
+
[basic.start]: basic.md#basic.start
|
| 684 |
+
[basic.start.dynamic]: basic.md#basic.start.dynamic
|
| 685 |
+
[basic.start.static]: basic.md#basic.start.static
|
| 686 |
+
[basic.stc]: basic.md#basic.stc
|
| 687 |
+
[basic.stc.auto]: basic.md#basic.stc.auto
|
| 688 |
+
[basic.stc.dynamic]: basic.md#basic.stc.dynamic
|
| 689 |
+
[basic.stc.dynamic.allocation]: basic.md#basic.stc.dynamic.allocation
|
| 690 |
+
[basic.stc.dynamic.deallocation]: basic.md#basic.stc.dynamic.deallocation
|
| 691 |
+
[basic.stc.static]: basic.md#basic.stc.static
|
| 692 |
+
[basic.stc.thread]: basic.md#basic.stc.thread
|
| 693 |
+
[basic.type.qualifier]: basic.md#basic.type.qualifier
|
| 694 |
+
[basic.types]: basic.md#basic.types
|
| 695 |
+
[class]: class.md#class
|
| 696 |
+
[class.access]: class.md#class.access
|
| 697 |
+
[class.base.init]: class.md#class.base.init
|
| 698 |
+
[class.bit]: class.md#class.bit
|
| 699 |
+
[class.compare.default]: class.md#class.compare.default
|
| 700 |
+
[class.conv]: class.md#class.conv
|
| 701 |
+
[class.conv.ctor]: class.md#class.conv.ctor
|
| 702 |
+
[class.conv.fct]: class.md#class.conv.fct
|
| 703 |
+
[class.copy.assign]: class.md#class.copy.assign
|
| 704 |
+
[class.copy.ctor]: class.md#class.copy.ctor
|
| 705 |
+
[class.copy.elision]: class.md#class.copy.elision
|
| 706 |
+
[class.ctor]: class.md#class.ctor
|
| 707 |
+
[class.default.ctor]: class.md#class.default.ctor
|
| 708 |
+
[class.dtor]: class.md#class.dtor
|
| 709 |
+
[class.expl.init]: class.md#class.expl.init
|
| 710 |
+
[class.friend]: class.md#class.friend
|
| 711 |
+
[class.inhctor.init]: class.md#class.inhctor.init
|
| 712 |
+
[class.init]: class.md#class.init
|
| 713 |
+
[class.mem]: class.md#class.mem
|
| 714 |
+
[class.member.lookup]: class.md#class.member.lookup
|
| 715 |
+
[class.mfct]: class.md#class.mfct
|
| 716 |
+
[class.mi]: class.md#class.mi
|
| 717 |
+
[class.name]: class.md#class.name
|
| 718 |
+
[class.pre]: class.md#class.pre
|
| 719 |
+
[class.qual]: basic.md#class.qual
|
| 720 |
+
[class.static]: class.md#class.static
|
| 721 |
+
[class.static.data]: class.md#class.static.data
|
| 722 |
+
[class.temporary]: basic.md#class.temporary
|
| 723 |
+
[class.union]: class.md#class.union
|
| 724 |
+
[class.union.anon]: class.md#class.union.anon
|
| 725 |
+
[class.virtual]: class.md#class.virtual
|
| 726 |
+
[conv]: expr.md#conv
|
| 727 |
+
[conv.array]: expr.md#conv.array
|
| 728 |
+
[conv.func]: expr.md#conv.func
|
| 729 |
+
[conv.lval]: expr.md#conv.lval
|
| 730 |
+
[conv.prom]: expr.md#conv.prom
|
| 731 |
+
[conv.ptr]: expr.md#conv.ptr
|
| 732 |
+
[conv.qual]: expr.md#conv.qual
|
| 733 |
+
[conv.rval]: expr.md#conv.rval
|
| 734 |
+
[coroutine.handle]: support.md#coroutine.handle
|
| 735 |
+
[coroutine.handle.resumption]: support.md#coroutine.handle.resumption
|
| 736 |
+
[dcl.align]: #dcl.align
|
| 737 |
+
[dcl.ambig.res]: #dcl.ambig.res
|
| 738 |
+
[dcl.array]: #dcl.array
|
| 739 |
+
[dcl.asm]: #dcl.asm
|
| 740 |
+
[dcl.attr]: #dcl.attr
|
| 741 |
+
[dcl.attr.depend]: #dcl.attr.depend
|
| 742 |
+
[dcl.attr.deprecated]: #dcl.attr.deprecated
|
| 743 |
+
[dcl.attr.fallthrough]: #dcl.attr.fallthrough
|
| 744 |
+
[dcl.attr.grammar]: #dcl.attr.grammar
|
| 745 |
+
[dcl.attr.likelihood]: #dcl.attr.likelihood
|
| 746 |
+
[dcl.attr.nodiscard]: #dcl.attr.nodiscard
|
| 747 |
+
[dcl.attr.noreturn]: #dcl.attr.noreturn
|
| 748 |
+
[dcl.attr.nouniqueaddr]: #dcl.attr.nouniqueaddr
|
| 749 |
+
[dcl.attr.unused]: #dcl.attr.unused
|
| 750 |
+
[dcl.constexpr]: #dcl.constexpr
|
| 751 |
+
[dcl.constinit]: #dcl.constinit
|
| 752 |
+
[dcl.dcl]: #dcl.dcl
|
| 753 |
+
[dcl.decl]: #dcl.decl
|
| 754 |
+
[dcl.enum]: #dcl.enum
|
| 755 |
+
[dcl.fct]: #dcl.fct
|
| 756 |
+
[dcl.fct.def]: #dcl.fct.def
|
| 757 |
+
[dcl.fct.def.coroutine]: #dcl.fct.def.coroutine
|
| 758 |
+
[dcl.fct.def.default]: #dcl.fct.def.default
|
| 759 |
+
[dcl.fct.def.delete]: #dcl.fct.def.delete
|
| 760 |
+
[dcl.fct.def.general]: #dcl.fct.def.general
|
| 761 |
+
[dcl.fct.default]: #dcl.fct.default
|
| 762 |
+
[dcl.fct.spec]: #dcl.fct.spec
|
| 763 |
+
[dcl.friend]: #dcl.friend
|
| 764 |
+
[dcl.init]: #dcl.init
|
| 765 |
+
[dcl.init.aggr]: #dcl.init.aggr
|
| 766 |
+
[dcl.init.list]: #dcl.init.list
|
| 767 |
+
[dcl.init.ref]: #dcl.init.ref
|
| 768 |
+
[dcl.init.string]: #dcl.init.string
|
| 769 |
+
[dcl.inline]: #dcl.inline
|
| 770 |
+
[dcl.link]: #dcl.link
|
| 771 |
+
[dcl.meaning]: #dcl.meaning
|
| 772 |
+
[dcl.mptr]: #dcl.mptr
|
| 773 |
+
[dcl.name]: #dcl.name
|
| 774 |
+
[dcl.pre]: #dcl.pre
|
| 775 |
+
[dcl.ptr]: #dcl.ptr
|
| 776 |
+
[dcl.ref]: #dcl.ref
|
| 777 |
+
[dcl.spec]: #dcl.spec
|
| 778 |
+
[dcl.spec.auto]: #dcl.spec.auto
|
| 779 |
+
[dcl.stc]: #dcl.stc
|
| 780 |
+
[dcl.struct.bind]: #dcl.struct.bind
|
| 781 |
+
[dcl.type]: #dcl.type
|
| 782 |
+
[dcl.type.auto.deduct]: #dcl.type.auto.deduct
|
| 783 |
+
[dcl.type.class.deduct]: #dcl.type.class.deduct
|
| 784 |
+
[dcl.type.cv]: #dcl.type.cv
|
| 785 |
+
[dcl.type.decltype]: #dcl.type.decltype
|
| 786 |
+
[dcl.type.elab]: #dcl.type.elab
|
| 787 |
+
[dcl.type.simple]: #dcl.type.simple
|
| 788 |
+
[dcl.typedef]: #dcl.typedef
|
| 789 |
+
[depr.volatile.type]: future.md#depr.volatile.type
|
| 790 |
+
[enum]: #enum
|
| 791 |
+
[enum.udecl]: #enum.udecl
|
| 792 |
+
[except.ctor]: except.md#except.ctor
|
| 793 |
+
[except.handle]: except.md#except.handle
|
| 794 |
+
[except.spec]: except.md#except.spec
|
| 795 |
+
[except.throw]: except.md#except.throw
|
| 796 |
+
[expr.alignof]: expr.md#expr.alignof
|
| 797 |
+
[expr.ass]: expr.md#expr.ass
|
| 798 |
+
[expr.await]: expr.md#expr.await
|
| 799 |
+
[expr.call]: expr.md#expr.call
|
| 800 |
+
[expr.cast]: expr.md#expr.cast
|
| 801 |
+
[expr.const]: expr.md#expr.const
|
| 802 |
+
[expr.const.cast]: expr.md#expr.const.cast
|
| 803 |
+
[expr.mptr.oper]: expr.md#expr.mptr.oper
|
| 804 |
+
[expr.new]: expr.md#expr.new
|
| 805 |
+
[expr.post.incr]: expr.md#expr.post.incr
|
| 806 |
+
[expr.pre.incr]: expr.md#expr.pre.incr
|
| 807 |
+
[expr.prim.lambda]: expr.md#expr.prim.lambda
|
| 808 |
+
[expr.prim.this]: expr.md#expr.prim.this
|
| 809 |
+
[expr.prop]: expr.md#expr.prop
|
| 810 |
+
[expr.ref]: expr.md#expr.ref
|
| 811 |
+
[expr.static.cast]: expr.md#expr.static.cast
|
| 812 |
+
[expr.sub]: expr.md#expr.sub
|
| 813 |
+
[expr.type.conv]: expr.md#expr.type.conv
|
| 814 |
+
[expr.unary]: expr.md#expr.unary
|
| 815 |
+
[expr.unary.op]: expr.md#expr.unary.op
|
| 816 |
+
[expr.yield]: expr.md#expr.yield
|
| 817 |
+
[intro.compliance]: intro.md#intro.compliance
|
| 818 |
+
[intro.execution]: basic.md#intro.execution
|
| 819 |
+
[intro.multithread]: basic.md#intro.multithread
|
| 820 |
+
[intro.object]: basic.md#intro.object
|
| 821 |
+
[lex.charset]: lex.md#lex.charset
|
| 822 |
+
[lex.digraph]: lex.md#lex.digraph
|
| 823 |
+
[lex.key]: lex.md#lex.key
|
| 824 |
+
[lex.name]: lex.md#lex.name
|
| 825 |
+
[lex.string]: lex.md#lex.string
|
| 826 |
+
[module.interface]: module.md#module.interface
|
| 827 |
+
[namespace.alias]: #namespace.alias
|
| 828 |
+
[namespace.def]: #namespace.def
|
| 829 |
+
[namespace.memdef]: #namespace.memdef
|
| 830 |
+
[namespace.qual]: basic.md#namespace.qual
|
| 831 |
+
[namespace.udecl]: #namespace.udecl
|
| 832 |
+
[namespace.udir]: #namespace.udir
|
| 833 |
+
[namespace.unnamed]: #namespace.unnamed
|
| 834 |
+
[over]: over.md#over
|
| 835 |
+
[over.binary]: over.md#over.binary
|
| 836 |
+
[over.match]: over.md#over.match
|
| 837 |
+
[over.match.best]: over.md#over.match.best
|
| 838 |
+
[over.match.class.deduct]: over.md#over.match.class.deduct
|
| 839 |
+
[over.match.conv]: over.md#over.match.conv
|
| 840 |
+
[over.match.copy]: over.md#over.match.copy
|
| 841 |
+
[over.match.ctor]: over.md#over.match.ctor
|
| 842 |
+
[over.match.funcs]: over.md#over.match.funcs
|
| 843 |
+
[over.match.list]: over.md#over.match.list
|
| 844 |
+
[over.match.ref]: over.md#over.match.ref
|
| 845 |
+
[over.match.viable]: over.md#over.match.viable
|
| 846 |
+
[over.oper]: over.md#over.oper
|
| 847 |
+
[over.sub]: over.md#over.sub
|
| 848 |
+
[special]: class.md#special
|
| 849 |
+
[stmt.ambig]: stmt.md#stmt.ambig
|
| 850 |
+
[stmt.dcl]: stmt.md#stmt.dcl
|
| 851 |
+
[stmt.expr]: stmt.md#stmt.expr
|
| 852 |
+
[stmt.if]: stmt.md#stmt.if
|
| 853 |
+
[stmt.iter]: stmt.md#stmt.iter
|
| 854 |
+
[stmt.label]: stmt.md#stmt.label
|
| 855 |
+
[stmt.pre]: stmt.md#stmt.pre
|
| 856 |
+
[stmt.return]: stmt.md#stmt.return
|
| 857 |
+
[stmt.return.coroutine]: stmt.md#stmt.return.coroutine
|
| 858 |
+
[stmt.select]: stmt.md#stmt.select
|
| 859 |
+
[stmt.stmt]: stmt.md#stmt.stmt
|
| 860 |
+
[stmt.switch]: stmt.md#stmt.switch
|
| 861 |
+
[support.runtime]: support.md#support.runtime
|
| 862 |
+
[temp.arg.type]: temp.md#temp.arg.type
|
| 863 |
+
[temp.class.spec]: temp.md#temp.class.spec
|
| 864 |
+
[temp.deduct]: temp.md#temp.deduct
|
| 865 |
+
[temp.deduct.call]: temp.md#temp.deduct.call
|
| 866 |
+
[temp.deduct.guide]: temp.md#temp.deduct.guide
|
| 867 |
+
[temp.dep]: temp.md#temp.dep
|
| 868 |
+
[temp.expl.spec]: temp.md#temp.expl.spec
|
| 869 |
+
[temp.explicit]: temp.md#temp.explicit
|
| 870 |
+
[temp.fct]: temp.md#temp.fct
|
| 871 |
+
[temp.inst]: temp.md#temp.inst
|
| 872 |
+
[temp.local]: temp.md#temp.local
|
| 873 |
+
[temp.mem]: temp.md#temp.mem
|
| 874 |
+
[temp.names]: temp.md#temp.names
|
| 875 |
+
[temp.over.link]: temp.md#temp.over.link
|
| 876 |
+
[temp.param]: temp.md#temp.param
|
| 877 |
+
[temp.pre]: temp.md#temp.pre
|
| 878 |
+
[temp.res]: temp.md#temp.res
|
| 879 |
+
[temp.spec]: temp.md#temp.spec
|
| 880 |
+
[temp.variadic]: temp.md#temp.variadic
|
| 881 |
+
|
| 882 |
+
[^1]: There is no special provision for a *decl-specifier-seq* that
|
| 883 |
+
lacks a *type-specifier* or that has a *type-specifier* that only
|
| 884 |
+
specifies *cv-qualifier*s. The “implicit int” rule of C is no longer
|
| 885 |
+
supported.
|
| 886 |
+
|
| 887 |
+
[^2]: As indicated by syntax, cv-qualifiers are a significant component
|
| 888 |
+
in function return types.
|
| 889 |
+
|
| 890 |
+
[^3]: One can explicitly disambiguate the parse either by introducing a
|
| 891 |
+
comma (so the ellipsis will be parsed as part of the
|
| 892 |
+
*parameter-declaration-clause*) or by introducing a name for the
|
| 893 |
+
parameter (so the ellipsis will be parsed as part of the
|
| 894 |
+
*declarator-id*).
|
| 895 |
+
|
| 896 |
+
[^4]: This means that default arguments cannot appear, for example, in
|
| 897 |
+
declarations of pointers to functions, references to functions, or
|
| 898 |
+
`typedef` declarations.
|
| 899 |
+
|
| 900 |
+
[^5]: As specified in [[conv.ptr]], converting an integer literal whose
|
| 901 |
+
value is `0` to a pointer type results in a null pointer value.
|
| 902 |
+
|
| 903 |
+
[^6]: The syntax provides for empty *braced-init-list*s, but nonetheless
|
| 904 |
+
C++ does not have zero length arrays.
|
| 905 |
+
|
| 906 |
+
[^7]: This requires a conversion function [[class.conv.fct]] returning a
|
| 907 |
+
reference type.
|
| 908 |
+
|
| 909 |
+
[^8]: Implementations are permitted to provide additional predefined
|
| 910 |
+
variables with names that are reserved to the implementation
|
| 911 |
+
[[lex.name]]. If a predefined variable is not odr-used
|
| 912 |
+
[[basic.def.odr]], its string value need not be present in the
|
| 913 |
+
program image.
|
| 914 |
+
|
| 915 |
+
[^9]: This set of values is used to define promotion and conversion
|
| 916 |
+
semantics for the enumeration type. It does not preclude an
|
| 917 |
+
expression of enumeration type from having a value that falls
|
| 918 |
+
outside this range.
|
| 919 |
+
|
| 920 |
+
[^10]: this implies that the name of the class or function is
|
| 921 |
+
unqualified.
|
| 922 |
+
|
| 923 |
+
[^11]: During name lookup in a class hierarchy, some ambiguities may be
|
| 924 |
+
resolved by considering whether one member hides the other along
|
| 925 |
+
some paths [[class.member.lookup]]. There is no such disambiguation
|
| 926 |
+
when considering the set of names found as a result of following
|
| 927 |
+
*using-directive*s.
|
| 928 |
+
|
| 929 |
+
[^12]: A *using-declaration* with more than one *using-declarator* is
|
| 930 |
+
equivalent to a corresponding sequence of *using-declaration*s with
|
| 931 |
+
one *using-declarator* each.
|