Subject: [Boost-bugs] [Boost C++ Libraries] #13565: Compilation issue with property_tree on VS2017 15.7
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-05-15 10:05:28
#13565: Compilation issue with property_tree on VS2017 15.7
-----------------------------------------------+---------------------------
Reporter: Pavel Pokutnev <pavel.pokutnev@â¦> | Owner: Sebastian
| Redl
Type: Bugs | Status: new
Milestone: Boost 1.68.0 | Component: property_tree
Version: Boost 1.67.0 | Severity: Showstopper
Keywords: |
-----------------------------------------------+---------------------------
The new Visual Studio 2017 15.7 with following compiler settings:
Conformance mode: Yes(/permissive-)
C++ Language Standard: ISO C++17 Standard (/std:c++17)
generates following error:
Error C3203 'iterator': unspecialized class template can't be used as
a template argument for template parameter 'Iterator', expected a real
type
: public boost::reverse_iterator<iterator>
during the compilation of the following code:
std::string value = { "[GENERAL]\n"
"MyValue=42" };
namespace bpt = boost::property_tree;
bpt::ptree tree;
try
{
std::istringstream input(value);
bpt::read_ini(input, tree); // Parse the INI-File into the property
tree.
}
catch (...)
{
}
int const v = tree.get<int>("GENERAL.MyValue", 0);
It looks like it has something todo with the deprecation of std::iterator
in C++17. In case the Conformance mode is switched to "No", the code
compiles without any errors. It is also dependent on project configuration
and include order, since my first try to create an isolated project for
demonstration didn't resulted in the same error. But I didn't invest much
time for it.
Here is my proposal for the solution of the issue: Prefix the template
parameter to make them fully qualified.
Change lines 112 and 122:
class basic_ptree<K, D, C>::reverse_iterator
: public boost::reverse_iterator<iterator>
and
class basic_ptree<K, D, C>::const_reverse_iterator
: public boost::reverse_iterator<const_iterator>
to:
class basic_ptree<K, D, C>::reverse_iterator
: public boost::reverse_iterator<basic_ptree<K, D, C>::iterator>
and
class basic_ptree<K, D, C>::const_reverse_iterator
: public boost::reverse_iterator<basic_ptree<K, D,
C>::const_iterator>
This resolves the issue on my side.
-- Ticket URL: <https://svn.boost.org/trac10/ticket/13565> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2018-05-15 10:11:01 UTC