Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#11541 closed Bugs (fixed)

Building with /Zc:wchar_t- on VC causes errors in boost::log since 1.59.0

Reported by: dd0t@… Owned by: Andrey Semashev
Milestone: To Be Determined Component: log
Version: Boost 1.59.0 Severity: Regression
Keywords: Cc:


Boost 1.58.0 and earlier could be built successfully with '/Zc:wchar_t-' (no native wchar_t type) set. Since boost 1.59.0 this causes template errors in boost log. More specifically in code_conversion.hpp . I'm not quite clear on whether boost is actually interested in being able to build with this flag enabled in the first place, however I won't be the only one seeing this regression as it isn't unusual for this flag to be present in Windows projects. For example Qt was built with it throughout the 4.X series and most old systems with some MFC dependency set it at some point to retain binary compatibility.

Here one of the error messages from Visual Studio 2013 (VC12) for reference (looks pretty much the same for VC14):

.\boost/log/detail/code_conversion.hpp(114) : error C2784: 'boost::enable_if_c<boost::log::v2s_mt_nt5::aux::is_character_type<T>::value&&boost::log::v2s_mt_nt5::aux::is_character_type<TargetCharT>::value&&sizeof(SourceCharT)!=sizeof(TargetCharT),void>::type boost::log::v2s_mt_nt5::aux::code_convert(const SourceCharT *,size_t,std::basic_string<TargetCharT,TargetTraitsT,TargetAllocatorT> &,const std::locale &)' : could not deduce template argument for 'const SourceCharT *' from 'const std::wstring'
        .\boost/log/detail/code_conversion.hpp(93) : see declaration of 'boost::log::v2s_mt_nt5::aux::code_convert'
.\boost/log/detail/code_conversion.hpp(114) : error C2893: Failed to specialize function template 'boost::enable_if_c<boost::log::v2s_mt_nt5::aux::is_character_type<T>::value&&boost::log::v2s_mt_nt5::aux::is_character_type<TargetCharT>::value&&sizeof(SourceCharT)!=sizeof(TargetCharT),void>::type boost::log::v2s_mt_nt5::aux::code_convert(const std::basic_string<_Elem,_Traits,_Alloc> &,std::basic_string<TargetCharT,TargetTraitsT,TargetAllocatorT> &,const std::locale &)'
        With the following template arguments:

Attachments (0)

Change History (3)

comment:1 Changed 3 years ago by dd0t@…

Component: Nonelog
Owner: set to Andrey Semashev

comment:2 Changed 3 years ago by Andrey Semashev

Resolution: fixed
Status: newclosed

Fixed in

To answer your question about emulated wchar_t support, I don't think there's much will to support it as this behavior is non-conforming (read: adds unnecessary problems) and can be relatively easily fixed with a compiler switch. Boost itself is built with the native wchar_t enabled, and this has been so for many years. Additionally, there are no testers with emulated wchar_t, so expect breakages.

With respect to Boost.Log, the emulated wchar_t is problematic as it makes certain parts of the library behave differently than normal. I added a note to the docs stating that. For now I fixed the compilation but in the future I may remove support for emulated wchar_t completely. I highly recommend switching to the native wchar_t.

comment:3 Changed 3 years ago by dd0t@…

Thanks for the quick fix. We are removing the flag with our transition to vc14. Since 1.59.0 is the first boost version to support that compiler being able to compile it with out legacy configuration and compiler makes handling the transition in our dependency management a easier.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Andrey Semashev.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.