Bug #2611
openUndefined behaviour due to adding declarations to namespace std
0%
Description
Your stdext.h
header has using-declarations to add boost entities to namespace std::tr1
, which is undefined according to the C++ standard.
The correct way to do it would be something like:
#if __cplusplus >= 201103L # include <functional> # include <memory> namespace stdext = std; #elif __GNUC__ >= 4 # include <tr1/functional> # include <tr1/memory> namespace stdext = std::tr1; #else # include <boost/version.hpp> // boost version checks and includes namespace stdext = boost; #endif
This declares stdext
as a namespace alias for whichever namespace contains the things you want to use. Then instead of using std::tr1::bind
and std::tr1::shared_ptr
use stdext::bind
and stdext::shared_ptr
.
However, since you already seem to use C++11 (I see std::unique_ptr
in thread.h
) it seems that you could get rid of stdext.h
and just use C++11's std::bind
, std::shared_ptr
, and std::weak_ptr
directly.
I can provide a patch to do that if you like.
The reason I'm looking at this is that I made some changes to std::tr1::bind
for the upcoming GCC 11 release, and your use of std::tr1::bind
no longer compiles. Switching to std::bind
would be one way to solve that problem.
No data to display