boostorg/spirit — pull request #35 by sehe (2014-06-05 22:53:33+00:00)
Title: Fix assignment basic_hold_any::operator=

The template version would not be used because the compiler-generated
one was a closer match. The implicit assignment, however, broke the
ownership semantics.

This case was inspired by this SO question: http://stackoverflow.com/q/24065769/85371

A smaller reproducer is here:

#include
#include
#include
typedef boost::spirit::hold_any any;

int main()
{
any b;
{
any a;
a = std::string("test_test_test");
b = a;
}

std::cout << "b: " << b << '\n';
}

This crashes with gcc/clang regardless of c++03/c++11 modes. It doesn't crash and runs valngrind-clean after the patch.