Article ID: 128600
Article Last Modified on 7/5/2005
APPLIES TO
- Microsoft Visual C++ 2.0 Professional Edition
- Microsoft Visual C++ 2.1
- Microsoft Visual C++ 4.0 Standard Edition
- Microsoft Visual C++ 4.1 Subscription
- Microsoft Visual C++ 4.2 Enterprise Edition
- Microsoft Visual C++ 4.2 Professional Edition
- Microsoft Visual C++ 5.0 Enterprise Edition
- Microsoft Visual C++ 5.0 Professional Edition
- Microsoft Visual C++ 6.0 Enterprise Edition
- Microsoft Visual C++ 6.0 Professional Edition
- Microsoft Visual C++ 6.0 Standard Edition
This article was previously published under Q128600
SYMPTOMS
When an enumerated type is declared in class scope, if it is declared again at global scope, the compiler will not generate an error. However, once redefined, the result of using those enumerated types is unpredictable.
RESOLUTION
An enumerated type should be defined only once within any scope.
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
MORE INFORMATION
Sample Code to Demonstrate Problem
/* Compiler options needed: /c */ class Test { public: enum status {a = 2, b}; }; enum Test::status {a = 4, b, c}; // Should be an error
REFERENCES
"The Annotated C++ Reference Manual" by Ellis and Stroustrup (Jan 1994), section 7.2
Additional query words: kbVC400bug 9.00 9.10 10.10 10.20
Keywords: kbbug kbcpponly kbcompiler KB128600