[Dune] Exception specifier for *operator new in debugallocator
Christoph Grüninger
christoph.grueninger at iws.uni-stuttgart.de
Wed Oct 10 07:59:06 CEST 2012
Good morning Dune, hi Christian,
while doing "make check" I got an error stating "declaration [..] has a
different exception specifier" in debugallocator.hh. Do the
implementations differ? Or may I apply the attached patch, which solves
the issue for me. Thou I suspect it will break the code for other
compilers...
Bye
Christoph
The error message:
> In file included from testdebugallocator.cc:8:0:
> ../../../dune/common/debugallocator.hh: In function ‘void* operator new(size_t)’:
> ../../../dune/common/debugallocator.hh:288:54: error: declaration of ‘void* operator new(size_t) throw (std::bad_alloc)’ has a different exception specifier
> In file included from /usr/include/c++/4.7/ext/new_allocator.h:34:0,
> from /usr/include/c++/4.7/x86_64-suse-linux/bits/c++allocator.h:34,
> from /usr/include/c++/4.7/bits/allocator.h:48,
> from /usr/include/c++/4.7/vector:62,
> from ../../../dune/common/debugallocator.hh:6,
> from testdebugallocator.cc:8:
> /usr/include/c++/4.7/new:93:7: error: from previous declaration ‘void* operator new(std::size_t)’
The patch:
Index: dune/common/debugallocator.hh
===================================================================
--- dune/common/debugallocator.hh (revision 7033)
+++ dune/common/debugallocator.hh (working copy)
@@ -285,7 +285,7 @@
}
#ifdef DEBUG_NEW_DELETE
-void * operator new(size_t size) throw(std::bad_alloc)
+void * operator new(size_t size)
{
// try to allocate size bytes
void *p = Dune::DebugMemory::alloc_man.allocate<char>(size);
More information about the Dune
mailing list