tmp/tmptncve61c/{from.md → to.md}
RENAMED
|
@@ -1,14 +1,36 @@
|
|
| 1 |
## Declaration matching <a id="over.dcl">[[over.dcl]]</a>
|
| 2 |
|
| 3 |
Two function declarations of the same name refer to the same function if
|
| 4 |
-
they are in the same scope and have equivalent parameter declarations
|
| 5 |
-
[[over.load]]
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
[*Example 1*:
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
``` cpp
|
| 11 |
struct B {
|
| 12 |
int f(int);
|
| 13 |
};
|
| 14 |
|
|
@@ -31,11 +53,11 @@ void h(D* pd) {
|
|
| 31 |
— *end example*]
|
| 32 |
|
| 33 |
A locally declared function is not in the same scope as a function in a
|
| 34 |
containing scope.
|
| 35 |
|
| 36 |
-
[*Example
|
| 37 |
|
| 38 |
``` cpp
|
| 39 |
void f(const char*);
|
| 40 |
void g() {
|
| 41 |
extern void f(int);
|
|
@@ -55,11 +77,11 @@ void caller () {
|
|
| 55 |
— *end example*]
|
| 56 |
|
| 57 |
Different versions of an overloaded member function can be given
|
| 58 |
different access rules.
|
| 59 |
|
| 60 |
-
[*Example
|
| 61 |
|
| 62 |
``` cpp
|
| 63 |
class buffer {
|
| 64 |
private:
|
| 65 |
char* p;
|
|
|
|
| 1 |
## Declaration matching <a id="over.dcl">[[over.dcl]]</a>
|
| 2 |
|
| 3 |
Two function declarations of the same name refer to the same function if
|
| 4 |
+
they are in the same scope and have equivalent parameter declarations
|
| 5 |
+
[[over.load]] and equivalent [[temp.over.link]] trailing
|
| 6 |
+
*requires-clause*s, if any [[dcl.decl]].
|
| 7 |
+
|
| 8 |
+
[*Note 1*:
|
| 9 |
+
|
| 10 |
+
Since a *constraint-expression* is an unevaluated operand, equivalence
|
| 11 |
+
compares the expressions without evaluating them.
|
| 12 |
|
| 13 |
[*Example 1*:
|
| 14 |
|
| 15 |
+
``` cpp
|
| 16 |
+
template<int I> concept C = true;
|
| 17 |
+
template<typename T> struct A {
|
| 18 |
+
void f() requires C<42>; // #1
|
| 19 |
+
void f() requires true; // OK, different functions
|
| 20 |
+
};
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
— *end example*]
|
| 24 |
+
|
| 25 |
+
— *end note*]
|
| 26 |
+
|
| 27 |
+
A function member of a derived class is *not* in the same scope as a
|
| 28 |
+
function member of the same name in a base class.
|
| 29 |
+
|
| 30 |
+
[*Example 2*:
|
| 31 |
+
|
| 32 |
``` cpp
|
| 33 |
struct B {
|
| 34 |
int f(int);
|
| 35 |
};
|
| 36 |
|
|
|
|
| 53 |
— *end example*]
|
| 54 |
|
| 55 |
A locally declared function is not in the same scope as a function in a
|
| 56 |
containing scope.
|
| 57 |
|
| 58 |
+
[*Example 3*:
|
| 59 |
|
| 60 |
``` cpp
|
| 61 |
void f(const char*);
|
| 62 |
void g() {
|
| 63 |
extern void f(int);
|
|
|
|
| 77 |
— *end example*]
|
| 78 |
|
| 79 |
Different versions of an overloaded member function can be given
|
| 80 |
different access rules.
|
| 81 |
|
| 82 |
+
[*Example 4*:
|
| 83 |
|
| 84 |
``` cpp
|
| 85 |
class buffer {
|
| 86 |
private:
|
| 87 |
char* p;
|