'<function-style-cast>': cannot convert from 'cmdline_error' to 'boost::system::system_error'

122 Views Asked by At

My project has been using boost 1.58 for ages. Now i have upgraded the visual studio version to 2017. And boost version 1.68.0

Boost 1.68.0 has some changes in its error_code class which breaks our build.

getting the following error

Error   C2440   '<function-style-cast>': cannot convert from 'cmdline_error' to 'boost::system::system_error'

where cmdline_error is defined as follows

enum cmdline_error
{
   success = 0,
   missing_argument,
   argument_conversion_failed
};

and this is the declaration which creates the error

cmdline_error cmdError;

boost::system::system_error systemError = boost::system::system_error(cmdError);

In linux build, the following error occurs

error: no matching function for call to ‘boost::system::system_error::system_error(cmdline_error)’

This code was working with boost 1.48, 1.58. 1.62

What is the correct way to handle this error here ?

0

There are 0 best solutions below