P
Patrick Kowalzick
Hello NG,
sorry to bother again, but I am a lit surprised that I got no answer on my
post (attached below).
So I refined the code a little bit
.
If there is a typedefed class X inside a class Y which has the same typedef
name and used in the form "Instance_Y::type::type" MSVC7.1 fails to compile.
See example below.
It looks like a kind of name-hiding, which I do not understand in this
context. In my opinion it should not be here (ok, i am not very good in
interpreting the standard).
If I posted in the wrong newsgroup, please tell me where I should post.
Regards,
Patrick
// ***** CODE START ******
#include <iostream>
template <typename T>
struct A_bar {
typedef T A_type;
typedef T A_value;
};
template <typename T>
struct B_bar {
typedef T B_type;
typedef T B_value;
};
template <typename T>
struct B_bar2 {
typedef T B_type;
typedef T B_value;
};
int main()
{
B_bar< A_bar<double> >::B_type::A_value x1;
B_bar< A_bar<double> >::B_type::A_type x2;
B_bar< B_bar<double> >::B_type::B_value y1;
// B_bar< B_bar<double> >::B_type::B_type y2; // this line causes errors
in MSVC 7.1
// test6.cpp(29) : error C2146: syntax error : missing ';' before
identifier 'y2'
// test6.cpp(29) : warning C4551: function call missing argument list
// test6.cpp(29) : error C2065: 'y2' : undeclared identifier
// but there is a small work-around
typedef B_bar< B_bar<double> >::B_type dummy_type_B;
dummy_type_B::B_type y3;
B_bar< B_bar2<double> >::B_type::B_value z1;
// B_bar< B_bar2<double> >::B_type::B_type z2; // same errors & warnings
// test6.cpp(34) : error C2146: syntax error : missing ';' before
identifier 'z2'
// test6.cpp(34) : warning C4551: function call missing argument list
// test6.cpp(34) : error C2065: 'z2' : undeclared identifier
// but there is the same workaround
typedef B_bar< B_bar2<double> >::B_type dummy_type_B2;
dummy_type_B2::B_type z3;
}
// ***** CODE END ******
sorry to bother again, but I am a lit surprised that I got no answer on my
post (attached below).
So I refined the code a little bit

If there is a typedefed class X inside a class Y which has the same typedef
name and used in the form "Instance_Y::type::type" MSVC7.1 fails to compile.
See example below.
It looks like a kind of name-hiding, which I do not understand in this
context. In my opinion it should not be here (ok, i am not very good in
interpreting the standard).
If I posted in the wrong newsgroup, please tell me where I should post.
Regards,
Patrick
// ***** CODE START ******
#include <iostream>
template <typename T>
struct A_bar {
typedef T A_type;
typedef T A_value;
};
template <typename T>
struct B_bar {
typedef T B_type;
typedef T B_value;
};
template <typename T>
struct B_bar2 {
typedef T B_type;
typedef T B_value;
};
int main()
{
B_bar< A_bar<double> >::B_type::A_value x1;
B_bar< A_bar<double> >::B_type::A_type x2;
B_bar< B_bar<double> >::B_type::B_value y1;
// B_bar< B_bar<double> >::B_type::B_type y2; // this line causes errors
in MSVC 7.1
// test6.cpp(29) : error C2146: syntax error : missing ';' before
identifier 'y2'
// test6.cpp(29) : warning C4551: function call missing argument list
// test6.cpp(29) : error C2065: 'y2' : undeclared identifier
// but there is a small work-around
typedef B_bar< B_bar<double> >::B_type dummy_type_B;
dummy_type_B::B_type y3;
B_bar< B_bar2<double> >::B_type::B_value z1;
// B_bar< B_bar2<double> >::B_type::B_type z2; // same errors & warnings
// test6.cpp(34) : error C2146: syntax error : missing ';' before
identifier 'z2'
// test6.cpp(34) : warning C4551: function call missing argument list
// test6.cpp(34) : error C2065: 'z2' : undeclared identifier
// but there is the same workaround
typedef B_bar< B_bar2<double> >::B_type dummy_type_B2;
dummy_type_B2::B_type z3;
}
// ***** CODE END ******