//gcc -std=c++2a  , due to the presence of std::variant
//I use kubuntu 21.04 / hirsute ,  gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0
//"Eclipse IDE for C/C++ Developers (includes Incubating components)" Version: 2021-06 (4.20.0) Build id: 20210612-2011
#include <iostream>
#include <string>
#include <vector>
#include <variant>
//#include <boost/array.hpp>
//#include <array>

//typedef std::string data_type; //if you use this type instead, it is fine
typedef std::vector<char> data_type;

int main(int argc, char *argv[])
{

	typedef std::variant<int,data_type> myvariant;
	myvariant value;
	value=data_type{};
	{
	  data_type& data=std::get<data_type >(value);
	  data.resize(1);//if you comment this line the problem goes away
	}
	data_type& data2=std::get<data_type >(value);//debugger terminates here in step by step debugging
	// when all of those conditions are met at the same time:
	// 1) variables window is present (if you remove it temporarily or you click on other tab/expression or breakpoint then debugger no longer terminates)
	// 2) data_type is std::vector<char> (if you change to std::string debugger no longer terminates)
	// 3) reply of the type char[] must be at least 425 bytes (if I dropped to 424 it did not terminated for me)
	    //  when used  std::array or boost::array instead it is at least 233 bytes (if you put 232 debugger no longer terminates)
	// 4) data.resize(1) above is present (if you disable line debugger no longer terminates
	std::cout << data2.size() << std::endl;
	char reply[425];
	//std::array<char,233> reply;//if this is less than 232 bytes or less problems goes away
	std::cout << "end of test" << std::endl;
    return 1;
}
