Description
[class.member.lookup] p7 says
If N is a non-dependent conversion-function-id, conversion function templates that are members of T are considered. For each such template F, the lookup set
S(t ,T)
is constructed, considering a function template declaration to have the namet
only if it corresponds to a declaration of F ([basic.scope.scope]). The members of the declaration set of each such lookup set, which shall not be an invalid set, are included in the result.
Consider this example
struct A{
template<class T>
operator T(); // #1
};
struct B:A{
template<class U>
operator U&&(); // #2
};
B b;
b.operator int(); // #3
Whether #1
corresponds to #2
is not clearly defined by [basic.scope.scope] p4 since the rule says
Two declarations correspond if they (re)introduce the same name, both declare constructors, or both declare destructors, unless
- [...]
- both declare function templates with equivalent non-object-parameter-type-lists, return types (if any), template-heads, and trailing requires-clauses (if any), and, if both are non-static members, they have corresponding object parameters.
About whether their types are equivalent, we define it in [temp.over.link] p6
When determining whether types or type-constraints are equivalent, the rules above are used to compare expressions involving template parameters.
Anyway, T
and U&&
that involve template parameters are not expressions. Moreover, this issue also exists for a common function template.
Activity