Opened 9 years ago

Closed 20 months ago

#9705 closed Bugs (wontfix)

Boost spirit fails to build with -DBOOST_NO_INTRINSIC_WCHAR_T

Reported by: Rocco Moretti <rmorettiase@…> Owned by: Joel de Guzman
Milestone: To Be Determined Component: spirit
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:

Description

Attempting to compile a program for Android using Boost::Spirit runs into the following problem:

Android compilation requires the -DBOOST_NO_INTRINSIC_WCHAR_T definition. This turns off BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,wchar_t,true) in boost/type_traits/is_integral.hpp

This then causes to_utf8() called by info::info(utf8_string, wchar_t) in boost/spirit/home/support/info.hpp to fail, as it calls boost::detail::make_unsigned_imp<wchar_t> which does a static assertion that the template parameter type is_integral or is_enum in boost/type_traits/make_unsigned.hpp

Note that in my parser I am not explicitly using wchar_t nor wstring - in fact I have no need of wchar/wstring support, with standard ASCII text being completely sufficient. (The string types I do explicitly use are std::string, character literals and boost::spirit::qi::ascii)

Example of the issue in compiling the libs/spirit/example/qi/roman.cpp example:

$g++ --version
g++ (GCC) 4.8.2

$g++ -isystem /home/morettr/Downloads/boost_1_55_0/ -o roman.o -c roman.cpp # No defines, no problems.
$g++ -isystem /home/morettr/Downloads/boost_1_55_0/ -o roman.o -c roman.cpp -DBOOST_NO_INTRINSIC_WCHAR_T -DBOOST_NO_CWCHAR -DBOOST_NO_STD_WSTRING
In file included from /home/morettr/Downloads/boost_1_55_0/boost/proto/traits.hpp:24:0,
                 from /home/morettr/Downloads/boost_1_55_0/boost/proto/expr.hpp:27,
                 from /home/morettr/Downloads/boost_1_55_0/boost/proto/core.hpp:17,
                 from /home/morettr/Downloads/boost_1_55_0/boost/proto/proto.hpp:12,
                 from /home/morettr/Downloads/boost_1_55_0/boost/spirit/home/support/meta_compiler.hpp:19,
                 from /home/morettr/Downloads/boost_1_55_0/boost/spirit/home/qi/meta_compiler.hpp:14,
                 from /home/morettr/Downloads/boost_1_55_0/boost/spirit/home/qi/action/action.hpp:14,
                 from /home/morettr/Downloads/boost_1_55_0/boost/spirit/home/qi/action.hpp:14,
                 from /home/morettr/Downloads/boost_1_55_0/boost/spirit/home/qi.hpp:14,
                 from /home/morettr/Downloads/boost_1_55_0/boost/spirit/include/qi.hpp:16,
                 from roman.cpp:18:
/home/morettr/Downloads/boost_1_55_0/boost/type_traits/make_unsigned.hpp: In instantiation of ‘struct boost::detail::make_unsigned_imp<wchar_t>’:
/home/morettr/Downloads/boost_1_55_0/boost/type_traits/make_unsigned.hpp:146:1:   required from ‘struct boost::make_unsigned<wchar_t>’
/home/morettr/Downloads/boost_1_55_0/boost/spirit/home/support/utf8.hpp:35:52:   required from ‘boost::spirit::utf8_string boost::spirit::to_utf8(Char) [with Char = wchar_t; boost::spirit::utf8_string = std::basic_string<char>]’
/home/morettr/Downloads/boost_1_55_0/boost/spirit/home/support/info.hpp:54:44:   required from here
/home/morettr/Downloads/boost_1_55_0/boost/type_traits/make_unsigned.hpp:38:4: error: invalid application of ‘sizeof’ to incomplete type ‘boost::STATIC_ASSERTION_FAILURE<false>’
    BOOST_STATIC_ASSERT(
    ^

This was tested with 1.55.0, but as far as I can tell from looking at the code on GitHub, the problem should still exist for the current development version. Also, it's not Android compiler specific - the example above was done with standard g++ on an x86 Linux box.

Desired outcome: All standard boost::spirit examples (except those which explicitly use wstring/wchar_t types) should compile and run with the "-DBOOST_NO_INTRINSIC_WCHAR_T -DBOOST_NO_CWCHAR -DBOOST_NO_STD_WSTRING" flag suite turned on.

Change History (1)

comment:1 by Joel de Guzman, 20 months ago

Resolution: wontfix
Status: newclosed

request to support an ancient compilers workaround without a patch

Note: See TracTickets for help on using tickets.