+2019-08-02 Martin Liska <mliska@suse.cz>
+
+ * decl.c (grok_op_properties):
+ Mark DECL_SET_IS_OPERATOR_DELETE for user-provided delete operators.
+
2019-08-01 Martin Sebor <msebor@redhat.com>
PR c++/90947
}
if (op_flags & OVL_OP_FLAG_DELETE)
- coerce_delete_type (decl, loc);
+ {
+ DECL_SET_IS_OPERATOR_DELETE (decl, true);
+ coerce_delete_type (decl, loc);
+ }
else
{
DECL_SET_IS_OPERATOR_NEW (decl, true);
+2019-08-02 Martin Liska <mliska@suse.cz>
+
+ * g++.dg/cpp1y/new2.C: New test.
+
2019-08-02 Senthil Kumar Selvaraj <senthilkumar.selvaraj@microchip.com>
* gcc.dg/torture/ssa-fre-6.c: Add dg-require-effective-target int32.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -std=c++17 -fdump-tree-cddce-details" } */
+
+#include <cstdio>
+#include <cstdlib>
+#include <new>
+
+void* operator new(std::size_t sz)
+{
+ std::printf("global op new called, size = %zu\n", sz);
+ void *ptr = std::malloc(sz);
+ if (ptr)
+ return ptr;
+ else
+ throw std::bad_alloc{};
+}
+
+void operator delete(void* ptr) noexcept
+{
+ std::puts("global op delete called");
+ std::free(ptr);
+}
+
+void
+new_primitive_load() {
+ int *x = new int;
+ int tmp = *x;
+ delete x;
+}
+
+void
+new_array_load() {
+ int *x = new int[10];
+ int tmp = x[4];
+ delete [] x;
+}
+
+/* { dg-final { scan-tree-dump-times "Deleting : _\\d+ = operator new" 2 "cddce1"} } */
+/* { dg-final { scan-tree-dump-times "Deleting : operator delete" 2 "cddce1"} } */