
6 Sep
2012
6 Sep
'12
1:29 a.m.
Hi! I face a problem using Boost.Variant 1.48 under Windows with Cygwin and g++ (GCC) 4.5.3. The following code crashes due to infinite recursion in the constructor of a_t: #include <boost/variant.hpp> #include <iostream> struct a_t { boost::variant< boost::recursive_wrapper<a_t>,int > child; }; int main() { a_t a; std::cout << "OK" << std::endl; return 0; } If I change the type of "child" to "boost::variant< int, boost::recursive_wrapper<a_t> >" (I just swapped the template parameters) the program prints "OK". Any ideas?