Boost logo

Boost Users :

Subject: [Boost-users] Boost.Variant: Infinite recursion in constructor
From: Markus Lenger (markus.lenger_at_[hidden])
Date: 2012-09-06 03:29:59


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?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net