tmp/tmpo0_uu59z/{from.md → to.md}
RENAMED
|
@@ -1,29 +1,26 @@
|
|
| 1 |
### Alignment specifier <a id="dcl.align">[[dcl.align]]</a>
|
| 2 |
|
| 3 |
An *alignment-specifier* may be applied to a variable or to a class data
|
| 4 |
member, but it shall not be applied to a bit-field, a function
|
| 5 |
-
parameter, or an *exception-declaration*
|
| 6 |
-
*alignment-specifier* may also be applied to the declaration
|
| 7 |
-
|
| 8 |
-
[[
|
| 9 |
-
|
| 10 |
-
*opaque-enum-declaration* or *enum-head*, respectively ([[dcl.enum]])).
|
| 11 |
-
An *alignment-specifier* with an ellipsis is a pack expansion (
|
| 12 |
-
[[temp.variadic]]).
|
| 13 |
|
| 14 |
When the *alignment-specifier* is of the form `alignas(`
|
| 15 |
*constant-expression* `)`:
|
| 16 |
|
| 17 |
- the *constant-expression* shall be an integral constant expression
|
| 18 |
-
- if the constant expression does not evaluate to an alignment value
|
| 19 |
-
[[basic.align]]
|
| 20 |
implementation does not support that alignment in the context of the
|
| 21 |
declaration, the program is ill-formed.
|
| 22 |
|
| 23 |
An *alignment-specifier* of the form `alignas(` *type-id* `)` has the
|
| 24 |
-
same effect as `alignas({}alignof(` *type-id* `))`
|
| 25 |
|
| 26 |
The alignment requirement of an entity is the strictest nonzero
|
| 27 |
alignment specified by its *alignment-specifier*s, if any; otherwise,
|
| 28 |
the *alignment-specifier*s have no effect.
|
| 29 |
|
|
@@ -56,11 +53,11 @@ different *alignment-specifier*s in different translation units.
|
|
| 56 |
``` cpp
|
| 57 |
// Translation unit #1:
|
| 58 |
struct S { int x; } s, *p = &s;
|
| 59 |
|
| 60 |
// Translation unit #2:
|
| 61 |
-
struct alignas(16) S; //
|
| 62 |
extern S* p;
|
| 63 |
```
|
| 64 |
|
| 65 |
— *end example*]
|
| 66 |
|
|
|
|
| 1 |
### Alignment specifier <a id="dcl.align">[[dcl.align]]</a>
|
| 2 |
|
| 3 |
An *alignment-specifier* may be applied to a variable or to a class data
|
| 4 |
member, but it shall not be applied to a bit-field, a function
|
| 5 |
+
parameter, or an *exception-declaration* [[except.handle]]. An
|
| 6 |
+
*alignment-specifier* may also be applied to the declaration of a class
|
| 7 |
+
(in an *elaborated-type-specifier* [[dcl.type.elab]] or *class-head*
|
| 8 |
+
[[class]], respectively). An *alignment-specifier* with an ellipsis is a
|
| 9 |
+
pack expansion [[temp.variadic]].
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
When the *alignment-specifier* is of the form `alignas(`
|
| 12 |
*constant-expression* `)`:
|
| 13 |
|
| 14 |
- the *constant-expression* shall be an integral constant expression
|
| 15 |
+
- if the constant expression does not evaluate to an alignment value
|
| 16 |
+
[[basic.align]], or evaluates to an extended alignment and the
|
| 17 |
implementation does not support that alignment in the context of the
|
| 18 |
declaration, the program is ill-formed.
|
| 19 |
|
| 20 |
An *alignment-specifier* of the form `alignas(` *type-id* `)` has the
|
| 21 |
+
same effect as `alignas({}alignof(` *type-id* `))` [[expr.alignof]].
|
| 22 |
|
| 23 |
The alignment requirement of an entity is the strictest nonzero
|
| 24 |
alignment specified by its *alignment-specifier*s, if any; otherwise,
|
| 25 |
the *alignment-specifier*s have no effect.
|
| 26 |
|
|
|
|
| 53 |
``` cpp
|
| 54 |
// Translation unit #1:
|
| 55 |
struct S { int x; } s, *p = &s;
|
| 56 |
|
| 57 |
// Translation unit #2:
|
| 58 |
+
struct alignas(16) S; // ill-formed, no diagnostic required: definition of S lacks alignment
|
| 59 |
extern S* p;
|
| 60 |
```
|
| 61 |
|
| 62 |
— *end example*]
|
| 63 |
|