tmp/tmpqz5ntzed/{from.md → to.md}
RENAMED
|
@@ -13,11 +13,11 @@ explicit-specifier:
|
|
| 13 |
explicit '(' constant-expression ')'
|
| 14 |
explicit
|
| 15 |
```
|
| 16 |
|
| 17 |
The `virtual` specifier shall be used only in the initial declaration of
|
| 18 |
-
a non-static
|
| 19 |
|
| 20 |
An *explicit-specifier* shall be used only in the declaration of a
|
| 21 |
constructor or conversion function within its class definition; see
|
| 22 |
[[class.conv.ctor]] and [[class.conv.fct]].
|
| 23 |
|
|
@@ -28,5 +28,16 @@ shall be a contextually converted constant expression of type `bool`
|
|
| 28 |
`explicit(true)`. If the constant expression evaluates to `true`, the
|
| 29 |
function is explicit. Otherwise, the function is not explicit. A `(`
|
| 30 |
token that follows `explicit` is parsed as part of the
|
| 31 |
*explicit-specifier*.
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
explicit '(' constant-expression ')'
|
| 14 |
explicit
|
| 15 |
```
|
| 16 |
|
| 17 |
The `virtual` specifier shall be used only in the initial declaration of
|
| 18 |
+
a non-static member function; see [[class.virtual]].
|
| 19 |
|
| 20 |
An *explicit-specifier* shall be used only in the declaration of a
|
| 21 |
constructor or conversion function within its class definition; see
|
| 22 |
[[class.conv.ctor]] and [[class.conv.fct]].
|
| 23 |
|
|
|
|
| 28 |
`explicit(true)`. If the constant expression evaluates to `true`, the
|
| 29 |
function is explicit. Otherwise, the function is not explicit. A `(`
|
| 30 |
token that follows `explicit` is parsed as part of the
|
| 31 |
*explicit-specifier*.
|
| 32 |
|
| 33 |
+
[*Example 1*:
|
| 34 |
+
|
| 35 |
+
``` cpp
|
| 36 |
+
struct S {
|
| 37 |
+
explicit(sizeof(char[2])) S(char); // error: narrowing conversion of value 2 to type bool
|
| 38 |
+
explicit(sizeof(char)) S(bool); // OK, conversion of value 1 to type bool is non-narrowing
|
| 39 |
+
};
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
— *end example*]
|
| 43 |
+
|