tmp/tmpk7phf7gq/{from.md → to.md}
RENAMED
|
@@ -18,39 +18,38 @@ conversion-declarator:
|
|
| 18 |
A declaration whose *declarator-id* has an *unqualified-id* that is a
|
| 19 |
*conversion-function-id* declares a *conversion function*; its
|
| 20 |
*declarator* shall be a function declarator [[dcl.fct]] of the form
|
| 21 |
|
| 22 |
``` bnf
|
| 23 |
-
|
| 24 |
-
ref-qualifier-seqₒₚₜ noexcept-specifierₒₚₜ attribute-specifier-seqₒₚₜ
|
| 25 |
```
|
| 26 |
|
| 27 |
-
where the *
|
| 28 |
optional *attribute-specifier-seq*, and optional surrounding
|
| 29 |
parentheses, and the *id-expression* has one of the following forms:
|
| 30 |
|
| 31 |
- in a *member-declaration* that belongs to the *member-specification*
|
| 32 |
of a class or class template but is not a friend declaration
|
| 33 |
[[class.friend]], the *id-expression* is a *conversion-function-id*;
|
| 34 |
- otherwise, the *id-expression* is a *qualified-id* whose
|
| 35 |
*unqualified-id* is a *conversion-function-id*.
|
| 36 |
|
| 37 |
A conversion function shall have no non-object parameters and shall be a
|
| 38 |
-
non-static member function of a class or class template `X`;
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
*
|
| 42 |
-
(if any) shall not be a
|
|
|
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
reference to it), or to cv `void`.[^6]
|
| 52 |
|
| 53 |
[*Example 1*:
|
| 54 |
|
| 55 |
``` cpp
|
| 56 |
struct X {
|
|
@@ -102,11 +101,11 @@ void g(X a, X b) {
|
|
| 102 |
The *conversion-type-id* shall not represent a function type nor an
|
| 103 |
array type. The *conversion-type-id* in a *conversion-function-id* is
|
| 104 |
the longest sequence of tokens that could possibly form a
|
| 105 |
*conversion-type-id*.
|
| 106 |
|
| 107 |
-
[*Note
|
| 108 |
|
| 109 |
This prevents ambiguities between the declarator operator `*` and its
|
| 110 |
expression counterparts.
|
| 111 |
|
| 112 |
[*Example 3*:
|
|
@@ -131,11 +130,11 @@ operator int [[noreturn]] (); // error: noreturn attribute applied to a type
|
|
| 131 |
|
| 132 |
— *end example*]
|
| 133 |
|
| 134 |
— *end note*]
|
| 135 |
|
| 136 |
-
[*Note
|
| 137 |
|
| 138 |
A conversion function in a derived class hides only conversion functions
|
| 139 |
in base classes that convert to the same type. A conversion function
|
| 140 |
template with a dependent return type hides only templates in base
|
| 141 |
classes that correspond to it [[class.member.lookup]]; otherwise, it
|
|
|
|
| 18 |
A declaration whose *declarator-id* has an *unqualified-id* that is a
|
| 19 |
*conversion-function-id* declares a *conversion function*; its
|
| 20 |
*declarator* shall be a function declarator [[dcl.fct]] of the form
|
| 21 |
|
| 22 |
``` bnf
|
| 23 |
+
noptr-declarator parameters-and-qualifiers
|
|
|
|
| 24 |
```
|
| 25 |
|
| 26 |
+
where the *noptr-declarator* consists solely of an *id-expression*, an
|
| 27 |
optional *attribute-specifier-seq*, and optional surrounding
|
| 28 |
parentheses, and the *id-expression* has one of the following forms:
|
| 29 |
|
| 30 |
- in a *member-declaration* that belongs to the *member-specification*
|
| 31 |
of a class or class template but is not a friend declaration
|
| 32 |
[[class.friend]], the *id-expression* is a *conversion-function-id*;
|
| 33 |
- otherwise, the *id-expression* is a *qualified-id* whose
|
| 34 |
*unqualified-id* is a *conversion-function-id*.
|
| 35 |
|
| 36 |
A conversion function shall have no non-object parameters and shall be a
|
| 37 |
+
non-static member function of a class or class template `X`; its
|
| 38 |
+
declared return type is the *conversion-type-id* and it specifies a
|
| 39 |
+
conversion from `X` to the type specified by the *conversion-type-id*,
|
| 40 |
+
interpreted as a *type-id* [[dcl.name]]. A *decl-specifier* in the
|
| 41 |
+
*decl-specifier-seq* of a conversion function (if any) shall not be a
|
| 42 |
+
*defining-type-specifier*.
|
| 43 |
|
| 44 |
+
[*Note 1*: A conversion function is never invoked for implicit or
|
| 45 |
+
explicit conversions of an object to the same object type (or a
|
| 46 |
+
reference to it), to a base class of that type (or a reference to it),
|
| 47 |
+
or to cv `void`. Even though never directly called to perform a
|
| 48 |
+
conversion, such conversion functions can be declared and can
|
| 49 |
+
potentially be reached through a call to a virtual conversion function
|
| 50 |
+
in a base class. — *end note*]
|
|
|
|
| 51 |
|
| 52 |
[*Example 1*:
|
| 53 |
|
| 54 |
``` cpp
|
| 55 |
struct X {
|
|
|
|
| 101 |
The *conversion-type-id* shall not represent a function type nor an
|
| 102 |
array type. The *conversion-type-id* in a *conversion-function-id* is
|
| 103 |
the longest sequence of tokens that could possibly form a
|
| 104 |
*conversion-type-id*.
|
| 105 |
|
| 106 |
+
[*Note 2*:
|
| 107 |
|
| 108 |
This prevents ambiguities between the declarator operator `*` and its
|
| 109 |
expression counterparts.
|
| 110 |
|
| 111 |
[*Example 3*:
|
|
|
|
| 130 |
|
| 131 |
— *end example*]
|
| 132 |
|
| 133 |
— *end note*]
|
| 134 |
|
| 135 |
+
[*Note 3*:
|
| 136 |
|
| 137 |
A conversion function in a derived class hides only conversion functions
|
| 138 |
in base classes that convert to the same type. A conversion function
|
| 139 |
template with a dependent return type hides only templates in base
|
| 140 |
classes that correspond to it [[class.member.lookup]]; otherwise, it
|