Boost C++ Libraries: Ticket #6132: lexical_cast with Source = void* broken in 1.48.0 https://svn.boost.org/trac10/ticket/6132 <p> Since 1.48.0, lexical_cast&lt;string&gt; does not compile anymore, where the Source type is void*. This worked fine in 1.47.0 and before. </p> <p> Example: </p> <pre class="wiki">#include &lt;string&gt; #include &lt;iostream&gt; #include &lt;boost/lexical_cast.hpp&gt; int main(int argc, const char **argv) { int x = 0; void *ptr = &amp;x; std::string s = boost::lexical_cast&lt;std::string&gt;(ptr); std::cout &lt;&lt; s &lt;&lt; std::endl; return 0; } </pre><p> Compiler output: </p> <pre class="wiki">..../boost/lexical_cast.hpp: In static member function ‘static Target boost::detail::lexical_cast_do_cast&lt;Target, Source&gt;::lexical_cast_impl(const Source&amp;) [with Target = std::string, Source = void*]’: ..../boost/lexical_cast.hpp:1916: instantiated from ‘Target boost::lexical_cast(const Source&amp;) [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 </pre><p> The problem seems to be that sizeof(void) is called in the calculation of 'const bool requires_stringbuf' (lexical_cast.hpp:1728). </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6132 Trac 1.4.3 Antony Polukhin Wed, 04 Jan 2012 16:06:43 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6132#comment:1 https://svn.boost.org/trac10/ticket/6132#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/76305" title="Fixes #6132 Fixes #6182">[76305]</a>) Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6132" title="#6132: Bugs: lexical_cast with Source = void* broken in 1.48.0 (closed: fixed)">#6132</a> Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6182" title="#6182: Bugs: lexical_cast: invalid application of 'sizeof' to incomplete type ... (closed: fixed)">#6182</a> </p> Ticket