
Larry Evans wrote:
I further jumped to the conclusion that *if* the variant had a null state, then it would not assume any of its bounded types were "in effect"; hence, would not call any destructors for any bounded type or perform any operations on any bounded type; hence, the pointer in recursive wrapper would not even need to be zeroed because the containing variant would not assume that it even had a recursive_wrapper as one of its bounded types.
You're quite correct. The problem does not stem from inadequate tagging though. The problem stems from the never-empty guarantee: http://www.boost.org/doc/libs/1_52_0/doc/html/variant/design.html#variant.de... If the variant could be empty, or equivalently, if the variant always contained a type that can be reliably default-constructed (without an exception) such as int, the problems with assignment (both copy- and move-) and with move construction do not occur, because the target can be left holding the int. So, one option is to enable move only in this case.