Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add exception specification for operator new and operator delete

Unfortunately, clang produces warnings for them
  • Loading branch information...
commit 988be6ffb54cc0278992d390b470f3ca17a47c85 1 parent d3f5c9f
shinichiro.hamaji@gmail.com authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/googletest.h
View
8 src/googletest.h
@@ -584,21 +584,21 @@ void (*g_new_hook)() = NULL;
_END_GOOGLE_NAMESPACE_
-void* operator new(size_t size) {
+void* operator new(size_t size) throw(std::bad_alloc) {
if (GOOGLE_NAMESPACE::g_new_hook) {
GOOGLE_NAMESPACE::g_new_hook();
}
return malloc(size);
}
-void* operator new[](size_t size) {
+void* operator new[](size_t size) throw(std::bad_alloc) {
return ::operator new(size);
}
-void operator delete(void* p) {
+void operator delete(void* p) throw() {
free(p);
}
-void operator delete[](void* p) {
+void operator delete[](void* p) throw() {
::operator delete(p);
}
Please sign in to comment.
Something went wrong with that request. Please try again.