J
Johannes Schaub
What should happen for this case:
struct A {
void f();
};
struct B : virtual A {
using A::f;
};
struct C : virtual A {
using A::f;
};
struct D : B, C {
void g() {
f();
}
};
The line of interest is `f()`. Clearly the lookup of `f` according to
`10.2` of the FDIS succeeds and finds `A::f`. However, what candidates will
overload resolution consider? The spec says at `13.3.1p4`:
class for the purpose of defining the type of the implicit object parameter.
The intent of this is that for a single class, if such a class contains both
own member functions and a using declaration bringing names of base class
functions into scope, that during overload resolution all the function
candidates have the same class type in their implicit object parameter. But
what does this mean for the above example? Will the candidates be the
following?
void F1(B&)
void F2(C&)
// call arguments: (lvalue D)
This appears to be wrong, because we only have one declaration in the lookup
result set according to `10.2p7`. How shall we interpret this??
PS: Please see the "cross-posted"
http://stackoverflow.com/questions/5683687/c0x-confusion-with-using-
declarations . Thanks!
struct A {
void f();
};
struct B : virtual A {
using A::f;
};
struct C : virtual A {
using A::f;
};
struct D : B, C {
void g() {
f();
}
};
The line of interest is `f()`. Clearly the lookup of `f` according to
`10.2` of the FDIS succeeds and finds `A::f`. However, what candidates will
overload resolution consider? The spec says at `13.3.1p4`:
derived class, the function is considered to be a member of the derivedFor non-conversion functions introduced by a using-declaration into a
class for the purpose of defining the type of the implicit object parameter.
The intent of this is that for a single class, if such a class contains both
own member functions and a using declaration bringing names of base class
functions into scope, that during overload resolution all the function
candidates have the same class type in their implicit object parameter. But
what does this mean for the above example? Will the candidates be the
following?
void F1(B&)
void F2(C&)
// call arguments: (lvalue D)
This appears to be wrong, because we only have one declaration in the lookup
result set according to `10.2p7`. How shall we interpret this??
PS: Please see the "cross-posted"
http://stackoverflow.com/questions/5683687/c0x-confusion-with-using-
declarations . Thanks!