tmp/tmpfe5u7y4z/{from.md → to.md}
RENAMED
|
@@ -64,11 +64,11 @@ template <int K, int L> A<K+L> f(A<K>, A<L>); // same as #1
|
|
| 64 |
template <int I, int J> A<I-J> f(A<I>, A<J>); // different from #1
|
| 65 |
```
|
| 66 |
|
| 67 |
— *end example*]
|
| 68 |
|
| 69 |
-
[*Note 2*: Most expressions that use template parameters use
|
| 70 |
template parameters, but it is possible for an expression to reference a
|
| 71 |
type parameter. For example, a template type parameter can be used in
|
| 72 |
the `sizeof` operator. — *end note*]
|
| 73 |
|
| 74 |
Two expressions involving template parameters are considered
|
|
@@ -95,12 +95,12 @@ signature of a function template with external linkage. — *end note*]
|
|
| 95 |
|
| 96 |
For determining whether two dependent names [[temp.dep]] are equivalent,
|
| 97 |
only the name itself is considered, not the result of name lookup.
|
| 98 |
|
| 99 |
[*Note 5*: If such a dependent name is unqualified, it is looked up
|
| 100 |
-
from
|
| 101 |
-
[[temp.
|
| 102 |
|
| 103 |
[*Example 3*:
|
| 104 |
|
| 105 |
``` cpp
|
| 106 |
template <int I, int J> void f(A<I+J>); // #1
|
|
@@ -156,34 +156,35 @@ declared with a *type-constraint*, and if either *template-head* has a
|
|
| 156 |
corresponding *constraint-expression*s are equivalent. Two
|
| 157 |
*template-parameter*s are *equivalent* under the following conditions:
|
| 158 |
|
| 159 |
- they declare template parameters of the same kind,
|
| 160 |
- if either declares a template parameter pack, they both do,
|
| 161 |
-
- if they declare
|
| 162 |
types ignoring the use of *type-constraint*s for placeholder types,
|
| 163 |
and
|
| 164 |
-
- if they declare template template parameters, their template
|
| 165 |
-
|
| 166 |
|
| 167 |
When determining whether types or *type-constraint*s are equivalent, the
|
| 168 |
rules above are used to compare expressions involving template
|
| 169 |
parameters. Two *template-head*s are *functionally equivalent* if they
|
| 170 |
accept and are satisfied by [[temp.constr.constr]] the same set of
|
| 171 |
template argument lists.
|
| 172 |
|
| 173 |
If the validity or meaning of the program depends on whether two
|
| 174 |
constructs are equivalent, and they are functionally equivalent but not
|
| 175 |
equivalent, the program is ill-formed, no diagnostic required.
|
| 176 |
-
Furthermore, if two
|
| 177 |
|
| 178 |
-
-
|
| 179 |
- have corresponding signatures [[basic.scope.scope]],
|
| 180 |
-
- would declare the same entity
|
| 181 |
-
|
| 182 |
- accept and are satisfied by the same set of template argument lists,
|
| 183 |
|
| 184 |
-
the program is ill-formed, no diagnostic
|
|
|
|
| 185 |
|
| 186 |
[*Note 7*:
|
| 187 |
|
| 188 |
This rule guarantees that equivalent declarations will be linked with
|
| 189 |
one another, while not requiring implementations to use heroic efforts
|
|
|
|
| 64 |
template <int I, int J> A<I-J> f(A<I>, A<J>); // different from #1
|
| 65 |
```
|
| 66 |
|
| 67 |
— *end example*]
|
| 68 |
|
| 69 |
+
[*Note 2*: Most expressions that use template parameters use constant
|
| 70 |
template parameters, but it is possible for an expression to reference a
|
| 71 |
type parameter. For example, a template type parameter can be used in
|
| 72 |
the `sizeof` operator. — *end note*]
|
| 73 |
|
| 74 |
Two expressions involving template parameters are considered
|
|
|
|
| 95 |
|
| 96 |
For determining whether two dependent names [[temp.dep]] are equivalent,
|
| 97 |
only the name itself is considered, not the result of name lookup.
|
| 98 |
|
| 99 |
[*Note 5*: If such a dependent name is unqualified, it is looked up
|
| 100 |
+
from a first declaration of the function template
|
| 101 |
+
[[temp.res.general]]. — *end note*]
|
| 102 |
|
| 103 |
[*Example 3*:
|
| 104 |
|
| 105 |
``` cpp
|
| 106 |
template <int I, int J> void f(A<I+J>); // #1
|
|
|
|
| 156 |
corresponding *constraint-expression*s are equivalent. Two
|
| 157 |
*template-parameter*s are *equivalent* under the following conditions:
|
| 158 |
|
| 159 |
- they declare template parameters of the same kind,
|
| 160 |
- if either declares a template parameter pack, they both do,
|
| 161 |
+
- if they declare constant template parameters, they have equivalent
|
| 162 |
types ignoring the use of *type-constraint*s for placeholder types,
|
| 163 |
and
|
| 164 |
+
- if they declare template template parameters, their *template-head*s
|
| 165 |
+
are equivalent.
|
| 166 |
|
| 167 |
When determining whether types or *type-constraint*s are equivalent, the
|
| 168 |
rules above are used to compare expressions involving template
|
| 169 |
parameters. Two *template-head*s are *functionally equivalent* if they
|
| 170 |
accept and are satisfied by [[temp.constr.constr]] the same set of
|
| 171 |
template argument lists.
|
| 172 |
|
| 173 |
If the validity or meaning of the program depends on whether two
|
| 174 |
constructs are equivalent, and they are functionally equivalent but not
|
| 175 |
equivalent, the program is ill-formed, no diagnostic required.
|
| 176 |
+
Furthermore, if two declarations A and B of function templates
|
| 177 |
|
| 178 |
+
- introduce the same name,
|
| 179 |
- have corresponding signatures [[basic.scope.scope]],
|
| 180 |
+
- would declare the same entity, when considering A and B to correspond
|
| 181 |
+
in that determination [[basic.link]], and
|
| 182 |
- accept and are satisfied by the same set of template argument lists,
|
| 183 |
|
| 184 |
+
but do not correspond, the program is ill-formed, no diagnostic
|
| 185 |
+
required.
|
| 186 |
|
| 187 |
[*Note 7*:
|
| 188 |
|
| 189 |
This rule guarantees that equivalent declarations will be linked with
|
| 190 |
one another, while not requiring implementations to use heroic efforts
|