A
adebaene
Hello all,
I just checked that the following did compile with VC2005 b2, and I
think it shouldn't:
template <typename T> struct A
{
typedef int Foo;
};
template <typename T> class B : public A<T>
{
Foo i; //line 1
};
int main()
{
B<float> b;
}
I believe that Foo is a dependent-name in B context, and therefore line
1 should be "typename A<T>::Foo i;".
Comeau online and gcc seems to agree with my reasoning, but I am quite
unable to fully understand norm 14.6.2. Could anyone shed some light on
this? Is this code legal or not?
Arnaud
MVP - VC
I just checked that the following did compile with VC2005 b2, and I
think it shouldn't:
template <typename T> struct A
{
typedef int Foo;
};
template <typename T> class B : public A<T>
{
Foo i; //line 1
};
int main()
{
B<float> b;
}
I believe that Foo is a dependent-name in B context, and therefore line
1 should be "typename A<T>::Foo i;".
Comeau online and gcc seems to agree with my reasoning, but I am quite
unable to fully understand norm 14.6.2. Could anyone shed some light on
this? Is this code legal or not?
Arnaud
MVP - VC