summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2015-05-06 20:25:38 +0300
committerIvan Maidanski <ivmai@mail.ru>2015-05-06 20:25:38 +0300
commit0f20f74f2e84fa94400b0f95833744ea42dc1bc7 (patch)
tree97f4d3f993c5eca42817e1438f1e129b6cd5a343
parentc53d2bcbeaa2d2aedb9b6c4a016ed9eb6d5887ad (diff)
downloadbdwgc-0f20f74f2e84fa94400b0f95833744ea42dc1bc7.tar.gz
Fix 'obj' local variable definition in new() in gc_cpp.h
* include/gc_cpp.h (operator new): Declare "obj" variable before switch statement (otherwise compiler reports "jump to case label ... crosses initialization of 'void* obj'" error).
-rw-r--r--include/gc_cpp.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/gc_cpp.h b/include/gc_cpp.h
index 2a240370..33c20792 100644
--- a/include/gc_cpp.h
+++ b/include/gc_cpp.h
@@ -420,9 +420,10 @@ inline gc_cleanup::gc_cleanup()
inline void* operator new(size_t size, GCPlacement gcp, GCCleanUpFunc cleanup,
void* clientData)
{
+ void* obj;
switch (gcp) {
case UseGC:
- void* obj = GC_MALLOC(size);
+ obj = GC_MALLOC(size);
if (cleanup != 0) {
GC_REGISTER_FINALIZER_IGNORE_SELF(obj, cleanup, clientData, 0, 0);
}