Consider the following program:
template <typename T>
struct t
{
struct base { void f1(); };
struct derived : base
{
void f2()
{
f1();
}
};
};
In derived::f2, unqualified lookup is used to find f1. Will base be searched? Will base::f1 be found? Is base a dependent type?
Please substantiate your answers with quotes from the standard.
Yes, base is dependent so f1 is not found. In C++03 this was clearified by the addition 14.6.1/2d (which did not exist in C++98) and in C++0x this is directly stated by 14.6.2.1/6 (n3126).
Dependency of it is important, because the following is possible
// for T = int, f1 does not exist.
template<> struct t<int>::base { };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With