Microsoft KB Archive/150000

= FIX: Minimal Rebuild Fails on Access Specifier Change for Enum =

Article ID: 150000

Article Last Modified on 7/5/2005

-

APPLIES TO


 * Microsoft Visual C++ 4.0 Professional Edition
 * Microsoft Visual C++ 4.1 Subscription
 * Microsoft Visual C++ 4.2 Professional Edition
 * Microsoft Visual C++ 4.2 Enterprise Edition
 * Microsoft Visual C++ 5.0 Learning Edition
 * Microsoft Visual C++ 5.0 Learning Edition

-



This article was previously published under Q150000



SYMPTOMS
Minimal Rebuild fails to detect the significance of access specifier changes for enums that are declared inside a class. For example, if the public definition of an enum in a class in a header file is changed to private, minimal rebuild does not see the change as significant, and files that depend on the header and the definition of the enum are not rebuilt. The following message is displayed:

Generating Code...

Skipping... (no relevant changes detected)



RESOLUTION
Doing a rebuild all or disabling minimal rebuild forces a full compile and correctly evaluates changes to the access specification of the enum. For details, please see the "More Information" section of this article.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ version 5.0.



Steps to Recreate Problem
 Create a default MFC application. On the File menu, click New, and then click Project Workspace. Name it Test, and select the default for all of the dialog boxes that follow.  In the main header file for the application, before the first public: in the application's class declaration, add the following enum definitions: class CMyTestApp : public CWinApp {  public:                //add these 3 lines enum e1 {E1,E2};  //to the header file Test.h       enum {UE1, UE2};   // public: CMyTestApp;   In the constructor of CAboutDlg, add references to the enums: CAboutDlg::CAboutDlg : CDialog(CAboutDlg::IDD) {      //AFX_DATA_INIT int i= CMy3209App::UE1;            //Add these 2 lines CMy3209App::e1 e = CMy3209App::E2; //to Test.cpp }                        Check to ensure that minimal rebuild is enabled. On the Build menu, click Settings, and then click C/C++ and category Customize. Build the application.  Comment out the first public: in the application's class declaration: // public:               //add these 3 lines  Build the appplication again (not rebuild all). There are no error messages.</li> Rebuild All. The following errors are generated:

<pre class="fixed_text">  Test.cpp(129) : error C2248: 'UE1' : cannot access private enumerator declared in class 'CMyTestApp' Test.cpp(130) : error C2248: 'e1' : cannot access private enum declared in class 'CMyTestApp' Test.cpp(130) : error C2248: 'E2' : cannot access private enumerator declared in class 'CMyTestApp'

</li></ol>

Additional query words: kbVC400bug 10.00 10.10 10.20

Keywords: kbbug kbfix kbvc500fix kbcpponly kbcompiler KB150000

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.