struct A
{
enum E
{
FIRST,
SECOND
};
};
struct B
{
typedef A::E E;
};
int main()
{
B::E e0 = A::FIRST;//OK (this case is clear for me)
B::E e1 = A::E::FIRST;//OK (this case is clear for me as well)
B::E e2 = B::FIRST;//Compile Error: FIRST is not member of B (Why isn't this allowed? Don't we lose meaning of typedef of enums in this case?)
B::E e3 = B::E::FIRST;//Error of compiler (If there were no bug in visual studio 2005 compiler, would this code work?)
return 0;
}
P.S.代码中的问题。typedefing枚举的问题。和视觉工作室中的错误2005
更新:其实这个错误在VS2010中修复。
这就是我正在寻找的标准短语,所以这个definitly *就是对“为什么?”的回答。 :) – Xeo 2011-05-19 22:49:13