1.1 --- a/sourcehook/test/testhookmangen.cpp Thu Nov 08 18:17:26 2007 +0000
1.2 +++ b/sourcehook/test/testhookmangen.cpp Fri Nov 09 06:19:18 2007 +0000
1.3 @@ -133,7 +133,7 @@
1.4 } \
1.5 template <> struct MakeRet< PodRet##size > \
1.6 { \
1.7 - static PodRet##size Do(int a) NO_OPTIMIZE \
1.8 + static PodRet##size Do(int a) \
1.9 { \
1.10 PodRet##size x; \
1.11 memset(reinterpret_cast<void*>(x.actPod.x), a, size); \
1.12 @@ -157,9 +157,10 @@
1.13 { \
1.14 static ObjRet##size Do(int a) NO_OPTIMIZE \
1.15 { \
1.16 - ObjRet##size x; \
1.17 - memset(reinterpret_cast<void*>(x.actObj.x), a, size); \
1.18 - return x; \
1.19 + ObjRet##size *x = new ObjRet##size; /* ptr: otherwise gcc optimizes away the temp obj */ \
1.20 + CAutoPtrDestruction< ObjRet##size > apd(x); \
1.21 + memset(reinterpret_cast<void*>(x->actObj.x), a, size); \
1.22 + return *x; \
1.23 } \
1.24 };
1.25