BUG: Visual C++ compiler does not report any error when you leave the parentheses off or when you leave the ampersand (&) off (155046)
The information in this article applies to:
- Microsoft Visual C++ 4.0
- Microsoft Visual C++ 4.1
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
This article was previously published under Q155046 SYMPTOMS Leaving the parentheses off a member function call, or
leaving the ampersand (&) off a reference to a pointer to a member
function, does not result in a compiler error. CAUSE In both cases, the Visual C++ compiler is incorrectly
treating the reference as a pointer to the member function. A pointer to a
member function cannot be referenced via a specific instance of a class (for
example, "obj.MyFunct" in the sample code below). Instead, it must be
referenced via the class name, scope operator and '&' operator (for
example, &CMyClass::MyFunc in the sample code below). RESOLUTION The compiler should report an error on the line in
question. STATUS Microsoft has confirmed this to be a bug in the Microsoft
products listed at the beginning of this article.
This problem was corrected in Microsoft Visual C++
.NET.
Modification Type: | Major | Last Reviewed: | 6/2/2005 |
---|
Keywords: | kbfunctions kbBug kbCodeGen kbCompiler kbCPPonly kbNoUpdate KB155046 kbAudDeveloper |
---|
|