id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 2983,"BOOST_CHECK_EQUAL gives error (or warning) ""use of old-style cast"" when compiled as C++",anonymous,Gennadiy Rozental,"BOOST_CHECK_EQUAL gives error (or warning) ""use of old-style cast"" when compiled as C++ (using g++ -Werror=old-style-cast). This is especially bad because we are supposed to use -Werror=old-style-cast in the build to keep our own code clean. Then BOOST gets in the way. We had similar issues with SDL: http://bugzilla.libsdl.org/show_bug.cgi?id=537 http://bugzilla.libsdl.org/show_bug.cgi?id=538 They accepted a fix that used special macros for casts: /* Use proper C++ casts when compiled as C++ to be compatible with the option + -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above. */ #ifdef __cplusplus #define SDL_reinterpret_cast(type, expression) reinterpret_cast(expression) #define SDL_static_cast(type, expression) static_cast(expression) #else #define SDL_reinterpret_cast(type, expression) ((type)(expression)) #define SDL_static_cast(type, expression) ((type)(expression)) #endif With that simple technique they could get their headers to work cleanly with C++ while staying compatible with C. Boost should fix this issue too. The following code shows how the bug can be reproduced: $ cat prov.cc #include void f () { BOOST_CHECK_EQUAL(0, 0); } $ LANG= g++ -c -Werror=old-style-cast prov.cc prov.cc: In function 'void f()': prov.cc:3: error: use of old-style cast prov.cc:3: error: use of old-style cast",Bugs,closed,Boost 1.39.0,test,Boost 1.37.0,Problem,fixed,,