tmp/tmp7kkkwa67/{from.md → to.md}
RENAMED
|
@@ -24,29 +24,29 @@ are type mismatches, and that
|
|
| 24 |
``` cpp
|
| 25 |
int f(X);
|
| 26 |
int f(Y);
|
| 27 |
```
|
| 28 |
|
| 29 |
-
declare an overloaded
|
| 30 |
-
|
| 31 |
|
| 32 |
``` cpp
|
| 33 |
struct S { int a; };
|
| 34 |
-
struct S { int a; }; // error
|
| 35 |
```
|
| 36 |
|
| 37 |
is ill-formed because it defines `S` twice.
|
| 38 |
|
| 39 |
— *end example*]
|
| 40 |
|
| 41 |
A class declaration introduces the class name into the scope where it is
|
| 42 |
declared and hides any class, variable, function, or other declaration
|
| 43 |
-
of that name in an enclosing scope
|
| 44 |
-
|
| 45 |
same name is also declared, then when both declarations are in scope,
|
| 46 |
-
the class can be referred to only using an *elaborated-type-specifier*
|
| 47 |
-
[[basic.lookup.elab]]
|
| 48 |
|
| 49 |
[*Example 2*:
|
| 50 |
|
| 51 |
``` cpp
|
| 52 |
struct stat {
|
|
@@ -103,21 +103,21 @@ class Vector {
|
|
| 103 |
// ...
|
| 104 |
friend Vector operator*(const Matrix&, const Vector&);
|
| 105 |
};
|
| 106 |
```
|
| 107 |
|
| 108 |
-
Declaration of
|
| 109 |
functions in [[over.oper]].
|
| 110 |
|
| 111 |
— *end example*]
|
| 112 |
|
| 113 |
— *end note*]
|
| 114 |
|
| 115 |
-
[*Note 2*: An *elaborated-type-specifier*
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
|
| 120 |
[*Example 5*:
|
| 121 |
|
| 122 |
``` cpp
|
| 123 |
struct s { int a; };
|
|
@@ -145,11 +145,8 @@ the name of a pointer to an object of that class. This means that the
|
|
| 145 |
elaborated form `class` `A` must be used to refer to the class. Such
|
| 146 |
artistry with names can be confusing and is best avoided.
|
| 147 |
|
| 148 |
— *end note*]
|
| 149 |
|
| 150 |
-
A *
|
| 151 |
-
|
| 152 |
-
*typedef-name* that names a cv-qualified class type is used where a
|
| 153 |
-
*class-name* is required, the cv-qualifiers are ignored. A
|
| 154 |
-
*typedef-name* shall not be used as the *identifier* in a *class-head*.
|
| 155 |
|
|
|
|
| 24 |
``` cpp
|
| 25 |
int f(X);
|
| 26 |
int f(Y);
|
| 27 |
```
|
| 28 |
|
| 29 |
+
declare an overloaded [[over]] function `f()` and not simply a single
|
| 30 |
+
function `f()` twice. For the same reason,
|
| 31 |
|
| 32 |
``` cpp
|
| 33 |
struct S { int a; };
|
| 34 |
+
struct S { int a; }; // error: double definition
|
| 35 |
```
|
| 36 |
|
| 37 |
is ill-formed because it defines `S` twice.
|
| 38 |
|
| 39 |
— *end example*]
|
| 40 |
|
| 41 |
A class declaration introduces the class name into the scope where it is
|
| 42 |
declared and hides any class, variable, function, or other declaration
|
| 43 |
+
of that name in an enclosing scope [[basic.scope]]. If a class name is
|
| 44 |
+
declared in a scope where a variable, function, or enumerator of the
|
| 45 |
same name is also declared, then when both declarations are in scope,
|
| 46 |
+
the class can be referred to only using an *elaborated-type-specifier*
|
| 47 |
+
[[basic.lookup.elab]].
|
| 48 |
|
| 49 |
[*Example 2*:
|
| 50 |
|
| 51 |
``` cpp
|
| 52 |
struct stat {
|
|
|
|
| 103 |
// ...
|
| 104 |
friend Vector operator*(const Matrix&, const Vector&);
|
| 105 |
};
|
| 106 |
```
|
| 107 |
|
| 108 |
+
Declaration of friends is described in [[class.friend]], operator
|
| 109 |
functions in [[over.oper]].
|
| 110 |
|
| 111 |
— *end example*]
|
| 112 |
|
| 113 |
— *end note*]
|
| 114 |
|
| 115 |
+
[*Note 2*: An *elaborated-type-specifier* [[dcl.type.elab]] can also be
|
| 116 |
+
used as a *type-specifier* as part of a declaration. It differs from a
|
| 117 |
+
class declaration in that if a class of the elaborated name is in scope
|
| 118 |
+
the elaborated name will refer to it. — *end note*]
|
| 119 |
|
| 120 |
[*Example 5*:
|
| 121 |
|
| 122 |
``` cpp
|
| 123 |
struct s { int a; };
|
|
|
|
| 145 |
elaborated form `class` `A` must be used to refer to the class. Such
|
| 146 |
artistry with names can be confusing and is best avoided.
|
| 147 |
|
| 148 |
— *end note*]
|
| 149 |
|
| 150 |
+
A *simple-template-id* is only a *class-name* if its *template-name*
|
| 151 |
+
names a class template.
|
|
|
|
|
|
|
|
|
|
| 152 |
|