Original Post
Why is it that the using declaration maintains the protected access of v... ...but as soon as I add templates... ...v becomes publicly accessible? I would think that the use of templates wouldn't affect the semantics of the using declaration. My compiler is G++ 4.1.1.
struct B
{
protected:
int v[3];
};
struct D : B
{
protected:
using B::v;
};
int main()
{
D d;
d.v[0] = 0;
return 0;
}
template <typename T> struct B
{
protected:
T v[3];
};
template <typename T> struct D : B<T>
{
protected:
using B<T>::v;
};
int main()
{
D<int> d;
d.v[0] = 0;
return 0;
}