Error message in Visual C++ when you delete a pointer to a const object: (131322)
The information in this article applies to:
- Microsoft Visual C++ for Windows, 16-bit edition 1.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++ for Windows, 16-bit edition 1.51
- Microsoft Visual C++ for Windows, 16-bit edition 1.52
- Microsoft Visual C++, 32-bit Editions 1.0
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 2.1
- Microsoft Visual C++, 32-bit Editions 4.0
- 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 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Visual C++ .NET (2003)
- Microsoft Visual C++ .NET (2002)
- Microsoft Visual C++ 2005 Express Edition
This article was previously published under Q131322 SYMPTOMS Attempting to delete a pointer to a constant causes the
compiler to generate the following correct error message: Error C2710 : cannot delete a pointer to a const object
NOTE: Visual C++ .NET compiler does not demonstrate this issue in
conformance to the changes made in the C++ ANSI Standards. CAUSE Deleting a pointer to a constant should not be allowed by
definition (ARM section 5.3.4) because it modifies the object pointed to.
However, if you deliberately or accidentally use the explicit conversion, the
compiler doesn't generate the error. The consequences of a such attempt are
unpredictable and compiler implementation dependent. STATUS This behavior is by design. REFERENCES For more information, see The Annotated C++ Reference
Manual (1994) section 5.3.4.
Modification Type: | Major | Last Reviewed: | 12/9/2005 |
---|
Keywords: | kbtshoot kberrmsg kbcode kbCompiler kbCPPonly kbprb KB131322 kbAudDeveloper |
---|
|