Created on 2009-04-05.00:00:00 last changed 197 months ago
Consider the following example:
auto concept A<class T> {
int f(T);
}
auto concept B<class T> {
int f(T)
template<class U>
requires A<U> // brings f(U') into scope
auto g(T p, U q) ->
decltype(f(p) + f(q));
// Both B<T>::f(T) and A<U>::f(U) needed here
// but B<T>::f(T) is hidden by A<U>::f(U)
// (declared in the same scope as g's template parameters)
}
This is similar to the case that motivated 11.4 [class.mem] paragraph 19:
A constrained member is treated as a constrained template (_N2914_.14.11 [temp.constrained]) whose template requirements include the requirements specified in its member-requirement clause and the requirements of each enclosing constrained template.
See also _N2914_.14.10.1.1 [concept.fct] paragraph 10 for a similar rule for default implementations.
A more general version of this merging of requirements is needed, but it does not appear to exist. _N2914_.14.11.1.2 [temp.req.impl] would seem to be the logical place for such a rule.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2009-08-03 00:00:00 | admin | set | status: open -> concepts |
| 2009-04-05 00:00:00 | admin | create | |