Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6037321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:03:21+00:00 2026-05-23T06:03:21+00:00

From the C++ standard (ISO/IEC 14882:2003(E)), §12.5.4, about overloading operator delete : If a

  • 0

From the C++ standard (ISO/IEC 14882:2003(E)), §12.5.4, about overloading operator delete:

If a delete-expression begins with a unary :: operator, the deallocation function’s name is looked up in global scope. Otherwise, if the delete-expression is used to deallocate a class object whose static type has a virtual destructor, the deallocation function is the one found by the lookup in the definition of the dynamic type’s virtual destructor (12.4). Otherwise, if the delete-expression is used to deallocate an object of
class T or array thereof, the static and dynamic types of the object shall be identical and the deallocation function’s name is looked up in the scope of T. If this lookup fails to find the name, the name is looked up in the global scope. If the result of the lookup is ambiguous or inaccessible, or if the lookup selects a placement deallocation function, the program is ill-formed.

§12.5.7 is also interesting:

Since member allocation and deallocation functions are static they cannot be virtual. [Note: however, when the cast-expression of a delete-expression refers to an object of class type, because the deallocation function actually called is looked up in the scope of the class that is the dynamic type of the object, if the destructor is virtual, the effect is the same. For example,

struct B {
    virtual ˜B();
    void operator delete(void*, size_t);
};
struct D : B {
    void operator delete(void*);
};
void f()
{
    B* bp = new D;
    delete bp; // uses D::operator delete(void*)
}

Here, storage for the non-array object of class D is deallocated by D::operator delete(), due to the virtual destructor.]

After reading this, I am wondering…

  • Is this part of the standard fully supported by all major C++ compilers (MSVC++, GCC)?
  • If so, how did they do it? Hidden virtual function? “Special” virtual destructor call? RTTI?
  • Using the example from the standard: can there be problems if f() and D::operator delete() are defined in separate EXE/DLL/DSOs? (Assuming that everything is compiled using the same compiler, of course)

§5.3.5.5 may also be relevant:

In the first alternative (delete object), if the static type of the operand is different from its dynamic type, the static type shall be a base class of the operand’s dynamic type and the static type shall have a virtual destructor or the behavior is undefined. In the second alternative (delete array) if the dynamic type of the object to be deleted differs from its static type, the behavior is undefined.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:03:22+00:00Added an answer on May 23, 2026 at 6:03 am

    I don’t know much about VC++ ABI, but the Itanium ABI is well documented.

    Looking up at the name mangling scheme, one see:

    <ctor-dtor-name> ::= C1     # complete object constructor
                     ::= C2     # base object constructor
                     ::= C3     # complete object allocating constructor
                     ::= D0     # deleting destructor
                     ::= D1     # complete object destructor
                     ::= D2     # base object destructor
    

    Of interest: D0 # deleting destructor, which means that even though delete is non virtual, since it is called from the virtual destructor, it can be considered virtual for all effects and purposes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know (hopefully) that MSVC 9.0 Implements C++ 2003 ( ISO/IEC 14882:2003 ). I
Why are there different PDF versions of the ISO/IEC 14882:2011 standard (C++11), which cost
It appears that according to ISO 14882 2003 (aka the Holy Standard of C++)
The C++ standard (ISO/IEC 14882:03) states the following ( 2.11 / 2 ): Furthermore,
I test the code in the c++ standard ISO/IEC 14882-03 14.6.1/9 on Xcode 4.1
It is not clear from the PDF ISO standard document (PDF32000-2008) whether a comment
This is the statement from ISO C++ Standard 14.6.4.1 Point of instantiation 4.If a
This is the statement from ISO C++ Standard 14.6.4.1 Point of instantiation For a
This is the statement from ISO C++ Standard 14.6.2.1: Dependent types : A type
This is the point from ISO :Standard Conversions:Array-to-pointer conversion: $4.2.1 An lvalue or rvalue

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.