tmp/tmpn4eawcgd/{from.md → to.md}
RENAMED
|
@@ -61,15 +61,26 @@ Two expressions involving template parameters are considered
|
|
| 61 |
*equivalent* if two function definitions containing the expressions
|
| 62 |
would satisfy the one definition rule ([[basic.def.odr]]), except that
|
| 63 |
the tokens used to name the template parameters may differ as long as a
|
| 64 |
token used to name a template parameter in one expression is replaced by
|
| 65 |
another token that names the same template parameter in the other
|
| 66 |
-
expression.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
``` cpp
|
| 69 |
template <int I, int J> void f(A<I+J>); // #1
|
| 70 |
template <int K, int L> void f(A<K+L>); // same as #1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
```
|
| 72 |
|
| 73 |
Two expressions involving template parameters that are not equivalent
|
| 74 |
are *functionally equivalent* if, for any given set of template
|
| 75 |
arguments, the evaluation of the expression results in the same value.
|
|
|
|
| 61 |
*equivalent* if two function definitions containing the expressions
|
| 62 |
would satisfy the one definition rule ([[basic.def.odr]]), except that
|
| 63 |
the tokens used to name the template parameters may differ as long as a
|
| 64 |
token used to name a template parameter in one expression is replaced by
|
| 65 |
another token that names the same template parameter in the other
|
| 66 |
+
expression. For determining whether two dependent names ([[temp.dep]])
|
| 67 |
+
are equivalent, only the name itself is considered, not the result of
|
| 68 |
+
name lookup in the context of the template. If multiple declarations of
|
| 69 |
+
the same function template differ in the result of this name lookup, the
|
| 70 |
+
result for the first declaration is used.
|
| 71 |
|
| 72 |
``` cpp
|
| 73 |
template <int I, int J> void f(A<I+J>); // #1
|
| 74 |
template <int K, int L> void f(A<K+L>); // same as #1
|
| 75 |
+
|
| 76 |
+
template <class T> decltype(g(T())) h();
|
| 77 |
+
int g(int);
|
| 78 |
+
template <class T> decltype(g(T())) h() // redeclaration of h() uses the earlier lookup
|
| 79 |
+
{ return g(T()); } // ...although the lookup here does find g(int)
|
| 80 |
+
int i = h<int>(); // template argument substitution fails; g(int)
|
| 81 |
+
// was not in scope at the first declaration of h()
|
| 82 |
```
|
| 83 |
|
| 84 |
Two expressions involving template parameters that are not equivalent
|
| 85 |
are *functionally equivalent* if, for any given set of template
|
| 86 |
arguments, the evaluation of the expression results in the same value.
|