Details
Description
If the current alternative of the variant is a type with a reference than the value of the reference is wrong.
In the following example struct A has a reference as a member (Minimal reproducer - simply put it in main.cpp):
#include <boost/variant.hpp> struct B { int value; }; struct A { B& ref; }; int main() { B b{23}; A a{b}; boost::variant<int, A> wrong{a}; return 0; }
The output in the "Locals and Expression" is the following:
a @0x7fffffffe1e0 A - ref @0x7fffffffe1e8 B & -- value 23 int b @0x7fffffffe1e8 B - value 23 int wrong @0x7fffffffe1d8 boost::variant<int, A> - ref @0x7fffffffe1d8 B & -- value -7704 int
The value of "value" in the last line should also be 23. Instead "-7704" is printed. "-7704" converted to hex: 0x7fffffffe1e8. So the debugging helper simply prints the reference itself.