tmp/tmpigrzsv4z/{from.md → to.md}
RENAMED
|
@@ -6,18 +6,24 @@ return. It shall appear at most once in each *attribute-list* and no
|
|
| 6 |
applied to the *declarator-id* in a function declaration. The first
|
| 7 |
declaration of a function shall specify the `noreturn` attribute if any
|
| 8 |
declaration of that function specifies the `noreturn` attribute. If a
|
| 9 |
function is declared with the `noreturn` attribute in one translation
|
| 10 |
unit and the same function is declared without the `noreturn` attribute
|
| 11 |
-
in another translation unit, the program is ill-formed
|
| 12 |
required.
|
| 13 |
|
| 14 |
If a function `f` is called where `f` was previously declared with the
|
| 15 |
`noreturn` attribute and `f` eventually returns, the behavior is
|
| 16 |
-
undefined.
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
[[ noreturn ]] void f() {
|
| 22 |
throw "error"; // OK
|
| 23 |
}
|
|
@@ -26,5 +32,7 @@ Implementations are encouraged to issue a warning if a function marked
|
|
| 26 |
if (i > 0)
|
| 27 |
throw "positive";
|
| 28 |
}
|
| 29 |
```
|
| 30 |
|
|
|
|
|
|
|
|
|
| 6 |
applied to the *declarator-id* in a function declaration. The first
|
| 7 |
declaration of a function shall specify the `noreturn` attribute if any
|
| 8 |
declaration of that function specifies the `noreturn` attribute. If a
|
| 9 |
function is declared with the `noreturn` attribute in one translation
|
| 10 |
unit and the same function is declared without the `noreturn` attribute
|
| 11 |
+
in another translation unit, the program is ill-formed, no diagnostic
|
| 12 |
required.
|
| 13 |
|
| 14 |
If a function `f` is called where `f` was previously declared with the
|
| 15 |
`noreturn` attribute and `f` eventually returns, the behavior is
|
| 16 |
+
undefined.
|
| 17 |
+
|
| 18 |
+
[*Note 1*: The function may terminate by throwing an
|
| 19 |
+
exception. — *end note*]
|
| 20 |
+
|
| 21 |
+
[*Note 2*: Implementations are encouraged to issue a warning if a
|
| 22 |
+
function marked `[[noreturn]]` might return. — *end note*]
|
| 23 |
+
|
| 24 |
+
[*Example 1*:
|
| 25 |
|
| 26 |
``` cpp
|
| 27 |
[[ noreturn ]] void f() {
|
| 28 |
throw "error"; // OK
|
| 29 |
}
|
|
|
|
| 32 |
if (i > 0)
|
| 33 |
throw "positive";
|
| 34 |
}
|
| 35 |
```
|
| 36 |
|
| 37 |
+
— *end example*]
|
| 38 |
+
|