Microsoft KB Archive/167348

From BetaArchive Wiki
Knowledge Base


Article ID: 167348

Article Last Modified on 12/8/2003



APPLIES TO

  • Microsoft Visual C++ 4.0 Standard Edition
  • Microsoft Visual C++ 4.1 Subscription
  • Microsoft Visual C++ 4.2 Enterprise Edition
  • Microsoft Visual C++ 5.0 Enterprise Edition
  • Microsoft Visual C++ 4.2 Professional Edition
  • Microsoft Visual C++ 5.0 Professional Edition



This article was previously published under Q167348

SYMPTOMS

A compiler error is not generated when a non-const member function is called via a temporary const object.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was corrected in Microsoft Visual C++ version 6.0.


MORE INFORMATION

Sample Code

   /* Compile Options Needed: None */ 
   class myClass
   {
   public:
     const myClass f();
     const myClass g();
   };

   int main( )
   {
     myClass mc;

     mc.f().g();     // The return value of f() is const, but g()
                     // is not a const member function. Therefore,
                     // an error should be generated.
     return 0;

   }
                

Keywords: kbbug kbfix kbvc600fix kbcode KB167348