Subject: [Boost-bugs] [Boost C++ Libraries] #7704: lexical_cast to filesystem::path fails for string::length > 22
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-11-16 19:32:52
#7704: lexical_cast to filesystem::path fails for string::length > 22
----------------------------------------------------+-----------------------
Reporter: Braden McDaniel <braden@â¦> | Type: Bugs
Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.52.0
Severity: Problem | Keywords:
----------------------------------------------------+-----------------------
When building with clang on Darwin using `-stdlib=libc++`, a
`lexical_cast` to a `filesystem::path` will fail if the input string is
longer than 22 elements.
Consider this test program:
{{{
#!C++
#include <boost/lexical_cast.hpp>
#include <boost/filesystem/path.hpp>
int main()
{
try {
boost::filesystem::path p;
std::string s1 = "aaaaaaaaaaaaaaaaaaaaaaa";
p = boost::lexical_cast<boost::filesystem::path>(s1);
} catch (std::exception & ex) {
std::cerr << ex.what() << std::endl;
return EXIT_FAILURE;
}
}
}}}
â¦compiled thusly:
{{{
clang++ -stdlib=libc++ -I /Users/bradenmcdaniel/Source/boost_1_52_0 -L
/Users/bradenmcdaniel/Source/boost_1_52_0/stage/lib -lboost_filesystem
-lboost_system -o lexical-cast-path lexical_cast_path.cpp
}}}
When run, it produces this output:
{{{
$ ./lexical-cast-path
bad lexical cast: source type value could not be interpreted as target
}}}
If the length of `s1` is reduced by 1 (from 23 to 22), the test program
will succeed.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7704> 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 : 2017-02-16 18:50:11 UTC