is compare_exchange_weak for std::shared_ptr broken in msvs 2013?

Viewed 544

Look at the sample, please

std::atomic < std::shared_ptr < int > > a;

std::shared_ptr < int > b;
std::shared_ptr < int > c = std::make_shared < int > (10);

while(a.compare_exchange_weak(b, c));

assert(a.load() == c);  
assert(a.load().use_count() == 2); // <- assertion is failed.

What do you think? Is it compiler error?

Build with msvs 2013 in win32 mode

3 Answers
Related