Microsoft KB Archive/129132

= BUG: Can't Use Simple Type in an Explicit Call of a Destructor =

PSS ID Number: 129132

Article Last Modified on 10/16/2002

-

The information in this article applies to:

 Microsoft C/C++ Compiler (CL.EXE), when used with:  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.52

 Microsoft Visual C++, 32-bit Editions 1.0</li></ul>

 Microsoft Visual C++, 32-bit Editions 2.0</li></ul>

 Microsoft Visual C++, 32-bit Editions 2.1</li></ul>

 Microsoft Visual C++, 32-bit Editions 4.0</li></ul>

 Microsoft Visual C++, 32-bit Editions 4.1</li></ul>

 Microsoft Visual C++, 32-bit Enterprise Edition 4.2</li></ul>

 Microsoft Visual C++, 32-bit Enterprise Edition 5.0</li></ul>

 Microsoft Visual C++, 32-bit Enterprise Edition 6.0</li></ul>

 Microsoft Visual C++, 32-bit Professional Edition 4.2</li></ul>

<ul> <li>Microsoft Visual C++, 32-bit Professional Edition 5.0</li></ul>

<ul> <li>Microsoft Visual C++, 32-bit Professional Edition 6.0</li></ul>

<ul> <li>Microsoft Visual C++, 32-bit Learning Edition 6.0</li></ul>

<ul> <li>Microsoft Visual C++ .NET (2002)</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q129132

<div class="symptoms_section">

SYMPTOMS
The notation for an explicit call of a destructor may be used for any simple type name. Using the notation for a type that does not have a destructor has no effect. However, for the products mentioned previously, the use of a simple type name causes the following compiler errors:

t.cpp(6): error C2611: 'int' : illegal following '~' (expected identifier)

t.cpp(6): error C2062: type 'int' unexpected

NOTE: The error numbers in Visual C++ .NET are C2611 and C26929, respectively.

<div class="resolution_section">

RESOLUTION
The Annotated C++ Reference Manual (Jan '94), section 12.4 contains the following example: int* p;  / ... p->int::~int; However, the current language grammar restricts the use of the ->~ and :: syntax to class names. Because at the current time simple types are not considered class names, the above syntax is not implemented by the compiler.

Until this language feature is implemented, removing the code is the only resolution.

<div class="status_section">

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

<div class="moreinformation_section">

MORE INFORMATION
Using an explicit call of a destructor for a simple type would have no effect, so removing it will not affect the compiled code. However, this may not be easy to do when this code is part of a macro expansion or templated class that should be able to accept both built-in and user-defined types.

<div class="references_section">

Sample Code
/* No special compile options needed. */   void main(void) {     int*    p;      p->int::~int;     // Generates C2611 error }

Additional query words: kbVC400bug 8.00 8.00c 9.00 9.10 template 10.00 10.10 10.20

Keywords: kbBug kbCompiler kbCPPonly KB129132

Technology: kbAudDeveloper kbCVCComp kbvc100 kbvc150 kbVC152 kbVC16bitSearch kbVC200 kbVC210 kbVC32bitSearch kbVC400 kbVC410 kbVC420 kbVC500 kbVC500Search kbVC600 kbVCNET kbVCsearch

-

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

© 2003 Microsoft Corporation. All rights reserved.