Subject: [Boost-bugs] [Boost C++ Libraries] #6132: lexical_cast with Source = void* broken in 1.48.0
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-11-17 14:44:34
#6132: lexical_cast with Source = void* broken in 1.48.0
---------------------------------------+------------------------------------
Reporter: jk_boost_bug@⦠| Owner: nasonov
Type: Bugs | Status: new
Milestone: To Be Determined | Component: lexical_cast
Version: Boost 1.48.0 | Severity: Regression
Keywords: |
---------------------------------------+------------------------------------
Since 1.48.0, lexical_cast<string> does not compile anymore, where the
Source type is void*. This worked fine in 1.47.0 and before.
Example:
{{{
#include <string>
#include <iostream>
#include <boost/lexical_cast.hpp>
int main(int argc, const char **argv) {
int x = 0;
void *ptr = &x;
std::string s = boost::lexical_cast<std::string>(ptr);
std::cout << s << std::endl;
return 0;
}
}}}
Compiler output:
{{{
..../boost/lexical_cast.hpp: In static member function âstatic Target
boost::detail::lexical_cast_do_cast<Target,
Source>::lexical_cast_impl(const Source&) [with Target = std::string,
Source = void*]â:
..../boost/lexical_cast.hpp:1916: instantiated from âTarget
boost::lexical_cast(const Source&) [with Target = std::string, Source =
void*]â
test.cpp:9: instantiated from here
.../boost/lexical_cast.hpp:1742: error: invalid application of âsizeofâ to
a void type
}}}
The problem seems to be that
sizeof(void) is called
in the calculation of
'const bool requires_stringbuf'
(lexical_cast.hpp:1728).
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6132> 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:07 UTC