diff --git a/repos/base/include/base/allocator.h b/repos/base/include/base/allocator.h index d0fe87794b..d39b603d38 100644 --- a/repos/base/include/base/allocator.h +++ b/repos/base/include/base/allocator.h @@ -249,6 +249,19 @@ void operator delete (void *, Genode::Deallocator *); void operator delete (void *, Genode::Deallocator &); +/** + * The compiler looks for a delete operator signature matching the one of the + * new operator. If none is found, it omits (silently!) the generation of + * implicitly delete calls, which are needed when an exception is thrown within + * the constructor of the object. + */ +inline void operator delete (void *ptr, Genode::Allocator *a) { + operator delete (ptr, static_cast(a)); } + +inline void operator delete (void *ptr, Genode::Allocator &a) { + operator delete (ptr, *static_cast(&a)); } + + /** * Destroy object * diff --git a/repos/base/run/new_delete.run b/repos/base/run/new_delete.run index 47122276c6..1e43acdbf4 100644 --- a/repos/base/run/new_delete.run +++ b/repos/base/run/new_delete.run @@ -49,6 +49,7 @@ compare_output_to { [init -> test-new_delete] ~B [init -> test-new_delete] ~C [init -> test-new_delete] ~A + [init -> test-new_delete] Allocator::free() [init -> test-new_delete] exception caught [init -> test-new_delete] Allocator::alloc() [init -> test-new_delete] A @@ -73,6 +74,7 @@ compare_output_to { [init -> test-new_delete] ~B [init -> test-new_delete] ~C [init -> test-new_delete] ~A + [init -> test-new_delete] Allocator::free() [init -> test-new_delete] exception caught } diff --git a/tool/autopilot.list b/tool/autopilot.list index c4f9602df7..899a8e238d 100644 --- a/tool/autopilot.list +++ b/tool/autopilot.list @@ -74,3 +74,4 @@ cpu_sampler cpu_sampler_noux usb_hid smartcard +new_delete