I am facing an issue where I have a configuration file and I parse it with boost::property_tree:info_parser.
I use this code to do the work:
struct _
It was Undefined Behaviour, specifically
The manifestation here is quite subtle!
Valgrind told me that info_parser::is_simple_data
is accessing a string freed. That string would be the local static. Both are being called from __run_exit_handlers()
but not in any particular order! See the linked C++FAQ entry for explanations.
Solution, don't depend on global statics with RAII:
int main()
{
_Config Config;
Config.Load();
}
is just fine, see it Live On Coliru