diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2018-01-15 08:20:02 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2018-01-15 08:20:02 +0300 |
commit | 3150107d3e12b06764e3fd4598cef0652e127b3c (patch) | |
tree | fbdcaaab7d848c35f03ba7cd18c32198297ba3ce /gc_cpp.cc | |
parent | ffe92c3e77cc29f543f6a54a6213c7f9191571f9 (diff) | |
download | bdwgc-3150107d3e12b06764e3fd4598cef0652e127b3c.tar.gz |
Fix global operator delete definition for C++14 in gc_cpp
Issue #195 (bdwgc).
Sized variants of global operator delete should be defined along with
the non-sized ones. Otherwise compiler might invoke the one from the
standard library (as observed in e.g. Cygwin) leading to a crash.
* gc_cpp.cc [!_MSC_VER && __cplusplus>201103L] (operator delete):
Define sized variant (the size argument is ignored for now).
* gc_cpp.cc [!_MSC_VER && __cplusplus>201103L && GC_OPERATOR_NEW_ARRAY
&& !CPPCHECK] (operator delete[]): Likewise.
Diffstat (limited to 'gc_cpp.cc')
-rw-r--r-- | gc_cpp.cc | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -62,4 +62,18 @@ built-in "new" and "delete". } # endif // GC_OPERATOR_NEW_ARRAY +# if __cplusplus > 201103L // C++14 + void operator delete(void* obj, size_t size) GC_DECL_DELETE_THROW { + (void)size; // size is ignored + GC_FREE(obj); + } + +# if defined(GC_OPERATOR_NEW_ARRAY) && !defined(CPPCHECK) + void operator delete[](void* obj, size_t size) GC_DECL_DELETE_THROW { + (void)size; + GC_FREE(obj); + } +# endif +# endif // C++14 + #endif // !_MSC_VER |