Giter Club home page Giter Club logo

convert's Issues

convert failure. boost::cnv::strtol exception

boost::cnv::strtol cnv;
std::string str = "0";
auto intValue = boost::convert<uint32_t>(
str,
cnv
(boost::cnv::parameter::skipws = true)
(boost::cnv::parameter::base = boost::cnv::base::hex)
).value();
this sentence will trigger exception.

One test from boost libraries failed to run after boost submodule convert updated from 8b6a8e to 72a571

Environment:
VS 2017 + Windows Server 2016

Issue description:
One test from boost libraries failed to run after boost submodule convert updated from 8b6a8e to 72a571 boost/convert@89f0ab7.Could you please take a look?

Reproduce steps:.

  1. git clone -c core.autocrlf=true --recursive ​https://github.com/boostorg/boost.git D:\Boost\src
  2. open a VS 2017 x64 command prompt and browse to D:\Boost\src
  3. .\bootstrap
  4. .\b2 headers variant=release --build-dir=..\out\x64rel address-model=64
  5. .\b2 variant=release --build-dir=..\out\x64rel address-model=64
  6. .\b2 -j4 variant=release --build-dir=..\out\x64rel libs\convert\test

log_x64_test_21.log

ErrorMessage:
.\boost/convert/stream.hpp(47): fatal error C1083: Cannot open include file: 'boost/parameter/is_argument_pack.hpp': No such file or directory
.\boost/mpl/has_key.hpp(33): error C2504: 'boost::mpl::has_key_implboost::parameter::aux::arg_list_tag::apply<AssociativeSequence,Key>': base class undefined
with
[
AssociativeSequence=boost::parameter::aux::tagged_argument<boost::cnv::parameter::type::base,const boost::cnv::base>,
Key=boost::cnv::parameter::type::base
]
.\boost/convert/base.hpp(118): error C2039: 'type': is not a member of 'boost::mpl::has_key<argument_pack,boost::cnv::parameter::type::base>'
with
[
argument_pack=boost::parameter::aux::tagged_argument<boost::cnv::parameter::type::base,const boost::cnv::base>
]
.\boost/convert/base.hpp(118): error C2512: 'boost::type': no appropriate default constructor available
.\boost/convert/base.hpp(118): note: The target type has no constructors
.\boost/convert/base.hpp(118): error C2672: 'boost::cnv::cnvbaseboost::cnv::printf::_assign': no matching overloaded function found
.\boost/convert/base.hpp(118): error C2780: 'void boost::cnv::cnvbaseboost::cnv::printf::assign(const argument_pack &,boost::cnv::parameter::type::fill,boost::mpl::true)': expects 3 arguments - 2 provided
.\boost/convert/base.hpp(120): error C2512: 'boost::type': no appropriate default constructor available
.\boost/convert/base.hpp(120): note: The target type has no constructors
.\boost/convert/base.hpp(120): error C2672: 'boost::cnv::cnvbaseboost::cnv::printf::_assign': no matching overloaded function found

Boost library spirit failed to build due to .\boost/spirit/home/qi/nonterminal/rule.hpp(304): error C2664: 'bool boost::function4<R,T0,T1,T2,T3>::operator ()(T0,T1,T2,T3) const': cannot convert argument 4 from 'const Skipper' to 'T3'

Environment:
VS 2017 + Windows Server 2016

Issue description:
We build and run test for Boost. And we found grammar_fail.cpp failed to build due to error C2664: 'bool boost::function4<R,T0,T1,T2,T3>::operator ()(T0,T1,T2,T3) const': cannot convert argument 4 from 'const Skipper' to 'T3'. Could you pleaes take a look? Thanks in advance.

Error info:
compile-c-c++ ..\out\x86rel\boost\bin.v2\libs\spirit\test\qi\qi_grammar_fail.test\msvc-14.1\release\threading-multi\qi_grammar_fail.obj
grammar_fail.cpp
.\boost/spirit/home/qi/nonterminal/rule.hpp(304): error C2664: 'bool
log_x86_test_99.log
boost::function4<R,T0,T1,T2,T3>::operator ()(T0,T1,T2,T3) const': cannot convert argument 4 from 'const Skipper' to 'T3'
with
[
R=bool,
T0=const char *&,
T1=const char *const &,
T2=boost::spirit::context<boost::fusion::cons<boost::spirit::unused_type &,boost::fusion::nil_>,boost::fusion::vector<>> &,
T3=const boost::spirit::qi::reference<const boost::spirit::qi::rule<const char *,boost::spirit::unused_type,boost::spirit::unused_type,boost::spirit::unused_type,boost::spirit::unused_type>> &
]
and
[
Skipper=skipper_type
]
and
[
T3=const boost::spirit::qi::reference<const boost::spirit::qi::rule<const char *,boost::spirit::unused_type,boost::spirit::unused_type,boost::spirit::unused_type,boost::spirit::unused_type>> &
]
.\boost/spirit/home/qi/nonterminal/rule.hpp(304): note: Reason: cannot convert from 'const Skipper' to 'const boost::spirit::qi::reference<const boost::spirit::qi::rule<const char *,boost::spirit::unused_type,boost::spirit::unused_type,boost::spirit::unused_type,boost::spirit::unused_type>>'
with
[
Skipper=skipper_type
]
.\boost/spirit/home/qi/nonterminal/rule.hpp(304): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
.\boost/spirit/home/qi/reference.hpp(43): note: see reference to function template instantiation 'bool boost::spirit::qi::rule<Iterator,T1,T2,T3,T4>::parse<Context,Skipper,Attribute>(Iterator &,const Iterator &,Context &,const Skipper &,Attribute &) const' being compiled
with
[
Iterator=const char *,
T1=boost::spirit::qi::rule<const char *,boost::spirit::unused_type,boost::spirit::unused_type,boost::spirit::unused_type,boost::spirit::unused_type>,
T2=boost::spirit::unused_type,
T3=boost::spirit::unused_type,
T4=boost::spirit::unused_type,
Context=const boost::spirit::unused_type,
Skipper=skipper_type,
Attribute=const boost::spirit::unused_type
]
.\boost/spirit/home/qi/reference.hpp(43): note: see reference to function template instantiation 'bool boost::spirit::qi::rule<Iterator,T1,T2,T3,T4>::parse<Context,Skipper,Attribute>(Iterator &,const Iterator &,Context &,const Skipper &,Attribute &) const' being compiled
with
[
Iterator=const char *,
T1=boost::spirit::qi::rule<const char *,boost::spirit::unused_type,boost::spirit::unused_type,boost::spirit::unused_type,boost::spirit::unused_type>,
T2=boost::spirit::unused_type,
T3=boost::spirit::unused_type,
T4=boost::spirit::unused_type,
Context=const boost::spirit::unused_type,
Skipper=skipper_type,
Attribute=const boost::spirit::unused_type
]
.\boost/spirit/home/qi/detail/parse.hpp(85): note: see reference to function template instantiation 'bool boost::spirit::qi::reference<const boost::spirit::qi::rule<Iterator,T1,T2,T3,T4>>::parse<Iterator,const boost::spirit::unused_type,skipper_type,const boost::spirit::unused_type>(Iterator &,const Iterator &,Context &,const Skipper &,Attribute &) const' being compiled
with
[
Iterator=const char *,
T1=boost::spirit::qi::rule<const char *,boost::spirit::unused_type,boost::spirit::unused_type,boost::spirit::unused_type,boost::spirit::unused_type>,
T2=boost::spirit::unused_type,
T3=boost::spirit::unused_type,
T4=boost::spirit::unused_type,
Context=const boost::spirit::unused_type,
Skipper=skipper_type,
Attribute=const boost::spirit::unused_type
]
.\boost/spirit/home/qi/detail/parse.hpp(84): note: see reference to function template instantiation 'bool boost::spirit::qi::reference<const boost::spirit::qi::rule<Iterator,T1,T2,T3,T4>>::parse<Iterator,const boost::spirit::unused_type,skipper_type,const boost::spirit::unused_type>(Iterator &,const Iterator &,Context &,const Skipper &,Attribute &) const' being compiled
with
[
Iterator=const char *,
T1=boost::spirit::qi::rule<const char *,boost::spirit::unused_type,boost::spirit::unused_type,boost::spirit::unused_type,boost::spirit::unused_type>,
T2=boost::spirit::unused_type,
T3=boost::spirit::unused_type,
T4=boost::spirit::unused_type,
Context=const boost::spirit::unused_type,
Skipper=skipper_type,
Attribute=const boost::spirit::unused_type
]
.\boost/spirit/home/qi/parse.hpp(121): note: see reference to function template instantiation 'bool boost::spirit::qi::detail::phrase_parse_impl<Expr,void>::call<Iterator,Skipper>(Iterator &,Iterator,const Expr &,const Skipper &,boost::spirit::qi::skip_flag)' being compiled
with
[
Expr=num_list,
Iterator=const char *,
Skipper=boost::proto::exprns_::expr<boost::proto::tagns_::tag::bitwise_or,boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<boost::spirit::tag::char_codeboost::spirit::tag::space,boost::spirit::char_encoding::standard>,0> &,const boost::proto::exprns_::expr<boost::proto::tagns_::tag::shift_right,boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::shift_right,boost::proto::argsns_::list2<boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<const char &>,0>,const boost::proto::exprns_::expr<boost::proto::tagns_::tag::dereference,boost::proto::argsns_::list1<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::complement,boost::proto::argsns_::list1<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<boost::spirit::terminal_ex<boost::spirit::tag::standard::char_,boost::fusion::vector>>,0> &>,1> &>,1> &>,2> &,boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<const char &>,0>>,2> &>,2>
]
.\boost/spirit/home/qi/parse.hpp(120): note: see reference to function template instantiation 'bool boost::spirit::qi::detail::phrase_parse_impl<Expr,void>::call<Iterator,Skipper>(Iterator &,Iterator,const Expr &,const Skipper &,boost::spirit::qi::skip_flag)' being compiled
with
[
Expr=num_list,
Iterator=const char ,
Skipper=boost::proto::exprns_::expr<boost::proto::tagns_::tag::bitwise_or,boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<boost::spirit::tag::char_codeboost::spirit::tag::space,boost::spirit::char_encoding::standard>,0> &,const boost::proto::exprns_::expr<boost::proto::tagns_::tag::shift_right,boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::shift_right,boost::proto::argsns_::list2<boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<const char &>,0>,const boost::proto::exprns_::expr<boost::proto::tagns_::tag::dereference,boost::proto::argsns_::list1<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::complement,boost::proto::argsns_::list1<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<boost::spirit::terminal_ex<boost::spirit::tag::standard::char_,boost::fusion::vector>>,0> &>,1> &>,1> &>,2> &,boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<const char &>,0>>,2> &>,2>
]
libs\spirit\test\qi\grammar_fail.cpp(36): note: see reference to function template instantiation 'bool boost::spirit::qi::phrase_parse<const char
,num_list,boost::proto::exprns_::expr<Tag,Args,2>>(Iterator &,Iterator,const Expr &,const Skipper &,boost::spirit::qi::skip_flag)' being compiled
with
[
Tag=boost::proto::tagns_::tag::bitwise_or,
Args=boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<boost::spirit::tag::char_codeboost::spirit::tag::space,boost::spirit::char_encoding::standard>,0> &,const boost::proto::exprns_::expr<boost::proto::tagns_::tag::shift_right,boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::shift_right,boost::proto::argsns_::list2<boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<const char &>,0>,const boost::proto::exprns_::expr<boost::proto::tagns_::tag::dereference,boost::proto::argsns_::list1<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::complement,boost::proto::argsns_::list1<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<boost::spirit::terminal_ex<boost::spirit::tag::standard::char_,boost::fusion::vector>>,0> &>,1> &>,1> &>,2> &,boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<const char &>,0>>,2> &>,
Iterator=const char *,
Expr=num_list,
Skipper=boost::proto::exprns_::expr<boost::proto::tagns_::tag::bitwise_or,boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<boost::spirit::tag::char_codeboost::spirit::tag::space,boost::spirit::char_encoding::standard>,0> &,const boost::proto::exprns_::expr<boost::proto::tagns_::tag::shift_right,boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::shift_right,boost::proto::argsns_::list2<boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<const char &>,0>,const boost::proto::exprns_::expr<boost::proto::tagns_::tag::dereference,boost::proto::argsns_::list1<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::complement,boost::proto::argsns_::list1<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<boost::spirit::terminal_ex<boost::spirit::tag::standard::char_,boost::fusion::vector>>,0> &>,1> &>,1> &>,2> &,boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,boost::proto::argsns_::term<const char &>,0>>,2> &>,2>
]

std::isspace requires unsigned

boost\convert\base.hpp(112): warning C6330: 'const char' passed as _Param_(1) when 'unsigned char' is required in call to 'isspace'.

boost\convert\base.hpp(115): warning C6330: 'const char' passed as _Param_(1) when 'unsigned char' is required in call to 'isspace'.

Boost library convert failed to build due to .\boost/convert/stream.hpp(32): error C2039: 'noncopyable': is not a member of 'boost'

Environment:
VS 2017 + Windows Server 2016

Issue description:
We build and run test for Boost. And we found fallbacks.cpp failed to build due to error C2039: 'noncopyable': is not a member of 'boost'. After we added #include <boost/noncopyable.hpp> into ".\boost/convert/stream.hpp" . It build fine. Could you pleaes take a look? Thanks in advance.

Error info:
compile-c-c++ ..\out\x86rel\boost\bin.v2\libs\convert\test\convert_test_fallbacks.test\msvc-14.1\release\asynch-exceptions-on\threading-multi\fallbacks.obj
fallbacks.cpp
.\boost/convert/stream.hpp(32): error C2039: 'noncopyable': is not a member of 'boost'
.\boost/bind/placeholders.hpp(26): note: see declaration of 'boost'
libs\convert\test\fallbacks.cpp(37): note: see reference to class template instantiation 'boost::cnv::basic_stream' being compiled
.\boost/bind/placeholders.hpp(54): note: see reference to class template instantiation 'boost::arg<9>' being compiled
.\boost/bind/placeholders.hpp(53): note: see reference to class template instantiation 'boost::arg<8>' being compiled
.\boost/bind/placeholders.hpp(52): note: see reference to class template instantiation 'boost::arg<7>' being compiled
.\boost/bind/placeholders.hpp(51): note: see reference to class template instantiation 'boost::arg<6>' being compiled
.\boost/bind/placeholders.hpp(50): note: see reference to class template instantiation 'boost::arg<5>' being compiled
.\boost/bind/placeholders.hpp(49): note: see reference to class template instantiation 'boost::arg<4>' being compiled
.\boost/bind/placeholders.hpp(48): note: see reference to class template instantiation 'boost::arg<3>' being compiled
.\boost/bind/placeholders.hpp(47): note: see reference to class template instantiation 'boost::arg<2>' being compiled
.\boost/bind/placeholders.hpp(46): note: see reference to class template instantiation 'boost::arg<1>' being compiled
.\boost/convert/stream.hpp(33): error C2504: 'noncopyable': base class undefined

call "..\out\x86rel\boost\bin.v2\standalone\msvc\msvc-14.1\msvc-setup.bat"  >nul

cl /Zm800 -nologo @"..\out\x86rel\boost\bin.v2\libs\convert\test\convert_test_fallbacks.test\msvc-14.1\release\asynch-exceptions-on\threading-multi\fallbacks.obj.rsp"

...failed compile-c-c++ ..\out\x86rel\boost\bin.v2\libs\convert\test\convert_test_fallbacks.test\msvc-14.1\release\asynch-exceptions-on\threading-multi\fallbacks.obj...

min() macro conflict

strtol.hpp:
ch_type  str[sz] = {0}; std::strncpy(str, &*range.begin(), std::min(sz - 1, range.size()));

// boost\convert\strtol.hpp(209): error C2589: '(': illegal token on right side of '::'

I think this isn't properly guarded against Windows's macro named min.
MSVC 15.8

charconv (from_chars) converter not work (crash)

Hello.

Boost-1.84
OS Windows 11.
Microsoft Visual Studio 2022 (Version 17.9.3)

Sample program:
`
#include
#include <boost/convert.hpp>

// If I comment line below, program not compiled
#include <boost/make_default.hpp>
#include <boost/convert/charconv.hpp>

int main()
{
auto cnv4 = boost::cnv::charconv();

std::string PuNum = "2";

const auto optPuNum = boost::convert<size_t>(PuNum, cnv4);

if (optPuNum)
	std::cout << *optPuNum << "\n";
else
	std::cout << "nullopt\n";

return 0;

}
`
If I comment out the line "#include <boost/make_default.hpp>" the program will not compile.
The use of this header is not obvious.

This program crashes with an error when calling boost::convert<size_t>().

The library is a C++11 library and should be documented as such

Since the library uses C++11 type_traits, along with Boost type_traits, the library is a C++11 library and should be documented as such. I actually see no reason to use both C++11 type_traits as well as Boost type_traits. If it is a C++11 library why not use C++11 type_traits throughout the library ?

Some test files failed to build due to "error: 'namespace arg = boost::cnv::boost::cnv::parameter;' redeclared as different kind of symbol"

The following files failed to build:
../libs/convert/test/performance.cpp:31:38: error: 'namespace arg = boost::cnv::boost::cnv::parameter;' redeclared as different kind of symbol
../libs/convert/test/spirit_converter.cpp:22:38: error: 'namespace arg = boost::cnv::boost::cnv::parameter;' redeclared as different kind of symbol
../libs/convert/test/stream_converter.cpp:26:38: error: 'namespace arg = boost::cnv::boost::cnv::parameter;' redeclared as different kind of symbol
../libs/convert/test/printf_converter.cpp:19:38: error: 'namespace arg = boost::cnv::boost::cnv::parameter;' redeclared as different kind of symbol
../libs/convert/test/strtol_converter.cpp:166:38: error: 'namespace arg = boost::cnv::boost::cnv::parameter;' redeclared as different kind of symbol

According to http://www.cplusplus.com/reference/complex/arg/, arg should be declared in complex as below:
complex (1) | template T arg (const complex& x);
arithmetic type (2) |  double arg (ArithmeticType x); // additional overloads

As a result, the arg declared in boost test files should be renamed.

charconv (from_chars) converter

C++17 has brought a new way to convert text to numbers, to_chars in charconv header.

So, it's time to implement charconv (or, maybe, it's better to explicitly call it from_chars) converter?

I could give a try on it if there are no objections.

convert_test_performance failed to link for <link>shared

clang-vxworks.link ../bin.v2/libs/convert/test/clang-vxworks/debug/cross-compile-vxworks/convert_test_performance.vxe
/llvm-8.0.0.1/LINUX64/bin/ldpentium: warning: ../bin.v2/libs/chrono/build/clang-vxworks/debug/cross-compile-vxworks/libboost_chrono.so.1.70.0, needed by ../bin.v2/libs/timer/build/clang-vxworks/debug/cross-compile-vxworks/libboost_timer.so.1.70.0, not found (try using -rpath or -rpath-link)
/llvm-8.0.0.1/LINUX64/bin/ldpentium: ../bin.v2/libs/timer/build/clang-vxworks/debug/cross-compile-vxworks/libboost_timer.so.1.70.0: undefined reference to `boost::chrono::steady_clock::now()'

/llvm-8.0.0.1/LINUX64/bin/ldpentium -m elf_x86_64 -L"/usr/lib/common" -o "../bin.v2/libs/convert/test/clang-vxworks/debug/cross-compile-vxworks/convert_test_performance.vxe" --defsym __wrs_rtp_base=0x200000 -u __wr_need_frame_add -u tls -T/usr/ldscripts/rtp.ld /usr/lib/common//crt0.o "../bin.v2/libs/convert/test/clang-vxworks/debug/cross-compile-vxworks/performance.o" "../bin.v2/libs/timer/build/clang-vxworks/debug/cross-compile-vxworks/libboost_timer.so.1.70.0" --as-needed -E --start-group -lunix -lnet -lc -lc_internal -lllvm -lcplusplus -lllvmcplus -ldl --end-group

...failed clang-vxworks.link ../bin.v2/libs/convert/test/clang-vxworks/debug/cross-compile-vxworks/convert_test_performance.vxe...

The link can succeed after I updated following line in libs/convert/test/jamfile.v2.

From:
exe convert_test_performance : performance.cpp /boost/timer//boost_timer ;
To:
exe convert_test_performance : performance.cpp /boost/timer//boost_timer /boost/chrono//boost_chrono ;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.