After adding the missing semicolon to B::E e3 = B::E::FIRSTthe following:
In C ++ 03, only the first line ( B::E e0 = A::FIRST;) is correct , the other three are errors:
B::E e1 = A::E::FIRST; // error: ‘A::E’ is not a class or namespace
B::E e2 = B::FIRST; // error: ‘FIRST’ is not a member of ‘B’
B::E e3 = B::E::FIRST; // error: ‘B::E’ is not a class or namespace
In C ++ 0x, only the second line ( B::E e2 = B::FIRST;) is an error (FIRST is still not a member of B!), The other three are correct.
Not an answer to the question “why?”, Just pointing out that there are two different problems. The rationale for the problem that affects e1 and e3 may be explained in the C ++ 0x working papers.
3.4.3 [basic.lookup.qual]/1,