This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/46224] Enhancement: Issue warning when matching placement delete operator is missing


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46224

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-09-26
     Ever confirmed|0                           |1

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
No they're completely unrelated. Remove throw(std::bad_alloc) from both
testcases to prevent those warnings.

Here's a C++11 version of comment 1:

using size_t = decltype(sizeof(0));

void* operator new( size_t num_bytes, const char* );

struct Foo
{
    Foo() { throw int(); }
};

void f()
{
    Foo* p = new(__FILE__) Foo();
}

EDG prints:

"del.cc", line 12: warning: function "operator new(size_t, const char *)" has
          no corresponding operator delete (to be called if an exception is
          thrown during initialization of an allocated object)
      Foo* p = new(__FILE__) Foo();
               ^

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]