This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 30th, when you will be able to use this site as normal.

    Forum Stats

  • 3,889,829 Users
  • 2,269,775 Discussions


Inconsistent handling of operator delete

koval Member Posts: 72 Blue Ribbon

Studio 12.5 and 12.6 incorrectly handles operator delete(void*, size_t) in constructor initializer list.

The following code sample shows the problem.

#include <new>class C {    friend class D;    friend class E;    void* operator new(std::size_t);    void operator delete(void*);    void operator delete(void*, std::size_t) = delete;};class D {    C* c;    D(): c(new C) { }};class E {    C* c = new C;};


line 15: Error: Using deleted function 'static C::operator delete(void*, unsigned)'.1 Error(s) detected.

As you can see, no error is reported in class E where C::operator new is called in direct initializer. In class D same expression is not accepted in constructor initializer list.


  • Steve.Clamage-Oracle
    Steve.Clamage-Oracle Oracle Studio C++ Project Lead Santa Clara, CA, USAMember Posts: 775
    edited Aug 21, 2017 6:37PM

    The code example compiles in C++11 mode, but in not C++14 mode.

    Thanks for reporting this issue. I have filed bug 26663195 for you.

    If you have a service contract for Studio, you can escalate this bug and get it fixed in a patch.

This discussion has been closed.