Boost 1.47, using Visual Studio 2010 and Visual Studio 2008, with boost 1.47 both built myself from source and with boost from the boostpro installers. (and with boost 1.47 rebuilt myself with /Zwchar_t- in msvc.jam).
If I set "treat wchar_t as builtin type" to "No", then the following code fails to compile:
#include
#include
void parseDate()
{
std::locale locale;
boost::date_time::format_date_parser parser(L"", locale);
boost::date_time::special_values_parser svp;
boost::gregorian::date date = parser.parse_date(L"", L"", svp);
}
It gives the following error:
c:\users\danielm\downloads\boost_1_47_0\boost_1_47_0\boost\lexical_cast.hpp(1116): error C2535: 'bool boost::detail::lexical_stream_limited_src::operator >>(unsigned short &)' : member function already defined or declared
with
[
CharT=char_type,
Base=base,
Traits=traits
]
c:\users\danielm\downloads\boost_1_47_0\boost_1_47_0\boost\lexical_cast.hpp(993) : see declaration of 'boost::detail::lexical_stream_limited_src::operator >>'
with
[
CharT=char_type,
Base=base,
Traits=traits
]
c:\users\danielm\downloads\boost_1_47_0\boost_1_47_0\boost\lexical_cast.hpp(1524) : see reference to class template instantiation 'boost::detail::lexical_stream_limited_src' being compiled
with
[
CharT=char_type,
Base=base,
Traits=traits
]
c:\users\danielm\downloads\boost_1_47_0\boost_1_47_0\boost\lexical_cast.hpp(1653) : see reference to function template instantiation 'Target boost::detail::lexical_cast(const std::basic_string<_Elem,_Traits,_Ax> &,CharT *,size_t)' being compiled
with
[
Target=short,
_Elem=wchar_t,
_Traits=std::char_traits,
_Ax=std::allocator,
CharT=char_type
]
c:\users\danielm\downloads\boost_1_47_0\boost_1_47_0\boost\lexical_cast.hpp(1641) : while compiling class template member function 'short boost::detail::lexical_cast_do_cast::lexical_cast_impl(const Source &)'
with
[
Target=short,
Source=src
]
c:\users\danielm\downloads\boost_1_47_0\boost_1_47_0\boost\lexical_cast.hpp(1813) : see reference to class template instantiation 'boost::detail::lexical_cast_do_cast' being compiled
with
[
Target=short,
Source=src
]
c:\users\danielm\downloads\boost_1_47_0\boost_1_47_0\boost\date_time\format_date_parser.hpp(72) : see reference to function template instantiation 'Target boost::lexical_cast>(const Source &)' being compiled
with
[
Target=short,
int_type=short,
_Elem=wchar_t,
_Traits=std::char_traits,
_Ax=std::allocator,
Source=std::basic_string,std::allocator>
]
c:\users\danielm\downloads\boost_1_47_0\boost_1_47_0\boost\date_time\format_date_parser.hpp(365) : see reference to function template instantiation 'int_type boost::date_time::fixed_string_to_int(std::istreambuf_iterator<_Elem,_Traits> &,std::istreambuf_iterator<_Elem,_Traits> &,boost::date_time::parse_match_result<charT> &,unsigned int,const charT &)' being compiled
with
[
int_type=short,
charT=wchar_t,
_Elem=wchar_t,
_Traits=std::char_traits
]
c:\users\danielm\downloads\boost_1_47_0\boost_1_47_0\boost\date_time\format_date_parser.hpp(254) : while compiling class template member function 'boost::gregorian::date boost::date_time::format_date_parser::parse_date(std::istreambuf_iterator<_Elem,_Traits> &,std::istreambuf_iterator<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Ax>,const boost::date_time::special_values_parser &) const'
with
[
date_type=boost::gregorian::date,
charT=wchar_t,
_Elem=wchar_t,
_Traits=std::char_traits,
_Ax=std::allocator
]
c:\source\dan\boost_wchar_t_test\boost_wchar_t_test\boost_wchar_t_test.cpp(18) : see reference to class template instantiation 'boost::date_time::format_date_parser' being compiled
with
[
date_type=boost::gregorian::date,
charT=wchar_t
]
If I set "wchar_t is builtin type" to Yes, then it compiles fine.
Testing with #pragma message to verify things, BOOST_NO_INTRINSIC_WCHAR_T is defined (or not defined) appropriately depending on how I set that compiler option, so it looks as if Boost knows what's going on at that level.
I've tried all the possible reconfigurations I can think of, but this error happens with the boostpro installs, with Boost built unchanged from the 1.47 distribution, and with Boost rebuilt with /Zwchar_t- set in msvc.jam.
Is there a way to solve this? The issue originally appears when trying to build code from another library -- but this is a minimal repro it with just boost code, so I think it's a Boost problem, unless I'm missing something.
thanks,
-- dan