diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/gc/gc_cpp.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/gc/gc_cpp.h b/include/gc/gc_cpp.h index 7fa81ecc..60281c0b 100644 --- a/include/gc/gc_cpp.h +++ b/include/gc/gc_cpp.h @@ -127,6 +127,10 @@ by UseGC. GC is an alias for UseGC, unless GC_NAME_CONFLICT is defined. #include "gc.h" +#ifdef GC_INCLUDE_NEW +# include <new> // for std, bad_alloc +#endif + #ifdef GC_NAMESPACE # define GC_NS_QUALIFY(T) boehmgc::T #else @@ -162,7 +166,6 @@ by UseGC. GC is an alias for UseGC, unless GC_NAME_CONFLICT is defined. # define GC_OP_NEW_OOM_CHECK(obj) \ do { if (!(obj)) GC_abort_on_oom(); } while (0) #elif defined(GC_INCLUDE_NEW) -# include <new> // for bad_alloc # define GC_OP_NEW_OOM_CHECK(obj) if (obj) {} else throw std::bad_alloc() #else // "new" header is not included, so bad_alloc cannot be thrown directly. |