Permalink
Browse files

Add exception specification for operator new and operator delete

Unfortunately, clang produces warnings for them
  • Loading branch information...
1 parent d3f5c9f commit 988be6ffb54cc0278992d390b470f3ca17a47c85 shinichiro.hamaji@gmail.com committed Jan 12, 2012
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);
}

0 comments on commit 988be6f

Please sign in to comment.