Boost C++ Libraries: Ticket #10354: inconsistent declaration of do_length in boost/detail/utf8_codecvt_facet.hpp due to missing BOOST_WORKAROUND https://svn.boost.org/trac10/ticket/10354 <p> First, the output when trying to build boost in AIX using xlC </p> <blockquote> <p> xlC_r -c -DBOOST_ALL_NO_LIB=1 -DNDEBUG -qcpluscmt -O3 -qstrict -q64 -qfuncsect -qeh -qrtti -I"." -o "bin.v2/libs/filesystem/build/vacpp-11/release/... utf8_codecvt_facet.o" "libs/filesystem/src/utf8_codecvt_facet.cpp" </p> </blockquote> <blockquote> <p> "./boost/detail/utf8_codecvt_facet.ipp", line 173.5: 1540-0400 (S) "boost::archive::detail::utf8_codecvt_facet::do_length(const std::mbstate_t &amp;, const char *, const char *, std::size_t) const" has a conflicting declaration. "./boost/detail/utf8_codecvt_facet.hpp", line 174.17: 1540-0424 (I) "do_length" is declared on line 174 of "./boost/detail/utf8_codecvt_facet.hpp". </p> </blockquote> <p> The problem is that there is a mismatch in the declaration of the function between </p> <ul><li>boost/detail/utf8_codecvt_facet.hpp </li><li>boost/detail/utf8_codecvt_facet.ipp </li></ul><div class="wiki-code"><div class="code"><pre> <span class="c1">// boost/detail/utf8_codecvt_facet.hpp </span> <span class="k">virtual</span> <span class="kt">int</span> <span class="n">do_length</span><span class="p">(</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="kt">mbstate_t</span> <span class="o">&amp;</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span> <span class="n">from</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span> <span class="n">from_end</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="kt">size_t</span> <span class="n">max_limit</span> <span class="p">)</span> <span class="k">const</span> </pre></div></div><div class="wiki-code"><div class="code"><pre> <span class="c1">// boost/detail/utf8_codecvt_facet.ipp </span> <span class="kt">int</span> <span class="n">utf8_codecvt_facet</span><span class="o">::</span><span class="n">do_length</span><span class="p">(</span> <span class="n">BOOST_CODECVT_DO_LENGTH_CONST</span> <span class="n">std</span><span class="o">::</span><span class="kt">mbstate_t</span> <span class="o">&amp;</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span> <span class="n">from</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span> <span class="n">from_end</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="kt">size_t</span> <span class="n">max_limit</span> <span class="p">)</span> <span class="k">const</span> <span class="cp">#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))</span> <span class="k">throw</span><span class="p">()</span> <span class="cp">#endif</span> </pre></div></div><p> The solution is to add BOOST_CODECVT_DO_LENGTH_CONST and the BOOST_WORKAROUND macro in boost/detail/utf8_codecvt_facet.hpp </p> <p> Also, unless BOOST_DETECT_OUTDATED_WORKAROUNDS is defined, BOOST_WORKAROUND will always evaluate to 1 for any version of xlC, adding a throw() declaration. </p> <p> Maybe it should be replaced with </p> <div class="wiki-code"><div class="code"><pre><span class="cp">#if BOOST_WORKAROUND(__IBMCPP__, &lt;=600)</span> </pre></div></div><p> Last, I've filed this in filesystem component following what was done for <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/7660"><span class="icon">​</span>https://svn.boost.org/trac/boost/ticket/7660</a> since there is no specific entry for boost/detail in the component list. It fits as well in serialization, program_options, etc. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10354 Trac 1.4.3 Beman Dawes Wed, 03 Sep 2014 21:59:00 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/10354#comment:1 https://svn.boost.org/trac10/ticket/10354#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> Fixed. Thanks! </p> <p> Here is the commit message: </p> <p> Fix <a class="reopened ticket" href="https://svn.boost.org/trac10/ticket/10354" title="#10354: Bugs: inconsistent declaration of do_length in ... (reopened)">#10354</a> from Juan Alday. As he pointed out, the declaration (in detail/utf8_codecvt_facet.hpp) and definition (in detail/utf8_codecvt_facet.ipp) need to use the same signature. </p> <p> Reapply Marshall Clow's [SVN <a class="changeset" href="https://svn.boost.org/trac10/changeset/81616" title="Fixed incorrect 'const' param for utf8_codecvt_facet::do_length">r81616</a>] and [SVN <a class="changeset" href="https://svn.boost.org/trac10/changeset/81877" title="Made codecvt::do_length param constant based on the library used, not ...">r81877</a>] from November and December, 2012, as these appear to correctly supply const for the msvc/dinkumware library (since fixed) that used a do_length() first argument. </p> <p> Revert the portion of [SVN <a class="changeset" href="https://svn.boost.org/trac10/changeset/86722" title="avoid conflict with standard library implementations">r86722</a>] that removed BOOST_CODECVT_DO_LENGTH_CONST from the do_length() signature in utf8_codecvt_facet.ipp so that it stays in sync with utf8_codecvt_facet.hpp. For the same reason, copy the <span class="underline">IBMCPP</span> workaround from utf8_codecvt_facet.ipp to utf8_codecvt_facet.hpp. </p> <p> Verified all libraries (filesystem, log, program_options, property_tree, serialization) that use utf8_codecvt_facet passed all tests before, and then after, these changes. </p> <p> Also applied minor edits to the use comments embedded in utf8_codecvt_facet.hpp. </p> <p> --Beman </p> Ticket Robert Ramey Fri, 05 Sep 2014 13:57:36 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/10354#comment:2 https://svn.boost.org/trac10/ticket/10354#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> After the original changes the test_array_warchive test in the serialization library test suite began to fail for all gcc compilers. </p> <p> After much time spent investigating this, I concluded that there were collisions in the the codecvt in the standard library and the boost one and I created [SVN <a class="changeset" href="https://svn.boost.org/trac10/changeset/86722" title="avoid conflict with standard library implementations">r86722</a>] to fix it. </p> <p> Now that's in backed out, this test is again failing. See <a href="http://www.boost.org/development/tests/develop/developer/serialization.html">http://www.boost.org/development/tests/develop/developer/serialization.html</a> </p> <p> On possible confusion is that the gcc compilers have an optional switch to select C++03 or C++11. It's not clear which testers use which switch. </p> <p> So I don't think we're done yet. Good luck with this. </p> <p> Robert Ramey </p> Ticket