This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/46224] Enhancement: Issue warning when matching placement delete operator is missing
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 26 Sep 2017 22:03:58 +0000
- Subject: [Bug c++/46224] Enhancement: Issue warning when matching placement delete operator is missing
- Auto-submitted: auto-generated
- References: <bug-46224-4@http.gcc.gnu.org/bugzilla/>
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();
^