Opened 10 years ago

Closed 10 years ago

#7205 closed Bugs (duplicate)

boost1.50 unorder_map not affect shared_ptr object reference count on mac 10.8

Reported by: wen max <wen.max8@…> Owned by: Daniel James
Milestone: To Be Determined Component: unordered
Version: Boost 1.50.0 Severity: Showstopper
Keywords: Cc:

Description

here is the test code:

#include <iostream> using namespace std;

#include <boost/smart_ptr.hpp> #include <boost/unordered_map.hpp>

typedef unsigned long long ulonglong;

class test {

int a;

public:

test(int i) : a(i) {} ~test() {}

};

int main(int argc, const char * argv[]) {

boost::unordered_map<ulonglong, boost::shared_ptr<test> > tt; boost::shared_ptr<test> e(new test(3)); tt.insert(make_pair(1314, e)); return 0;

}

I'm developing program under mac 10.8 with Xcode 4.4 . When using unordered_map with upper codes, boost150 will not add reference count of var e, but boost 149 works fine.

When doing this test, I switch the include header folder of /usr/local/include/boost betweet boost150 and boost 149.

Change History (2)

comment:1 by wen max <wen.max8@…>, 10 years ago

I've done more test about this, that I can confirm this is a bug of Apple llvm compiler . Under mac 10.8 console with g++ compile without any problem.

comment:2 by Daniel James, 10 years ago

Resolution: duplicate
Status: newclosed

Sorry, it's actually an unordered bug. It only happens when using a C++03 allocator with a C++11 compiler, which is why it doesn't show up for g++. It will be fixed in the new release, and there's a patch at:

http://www.boost.org/patches/1_50_0/001-unordered.patch

Closing this as a duplicate of #7100.

Note: See TracTickets for help on using tickets.