Opened 12 years ago
Last modified 12 years ago
#4714 new Bugs
boost::tokenizer_detail::traits_extension does not expose correctly std::_Secure_char_traits_tag on VC9
Reported by: | Owned by: | jsiek | |
---|---|---|---|
Milestone: | To Be Determined | Component: | tokenizer |
Version: | Boost 1.44.0 | Severity: | Problem |
Keywords: | Cc: |
Description
This issues warning C4996: 'std::char_traits<char>::[various] ': Function call with parameters that may be unsafe because VC STL relies on a tag to chose the safe/unsafe version of the function.
typedef std::basic_string<char>::traits_type Tr; typedef boost::tokenizer_detail::traits_extension<Tr> Traits; cout << typeid(std::_Char_traits_category_helper<Tr,true>::_Secure_char_traits).name() << endl; cout << typeid(std::_Char_traits_category_helper<Traits,true>::_Secure_char_traits).name() << endl;
prints
_Secure_char_traits_tag _Unsecure_char_traits_tag
because _Char_traits_category_helper is defined as
template <class _Traits> class _Char_traits_category_helper<_Traits, true> { public: typedef typename _Traits::_Secure_char_traits _Secure_char_traits; };
so it defers to a typedef of _Secure_char_traits inside the trait. By default it is defined to _Unsecure_char_traits_tag.
This affects builds with /WX (treat warnings as errors) and generally causes a lot of warnings for otherwise harmless code (for example date_time relies on tokenizer to parse strings)
Note:
See TracTickets
for help on using tickets.
A possible fix would be to add this in the definition of traits_extension ( token_functions.hpp line 215 for boost 1_44)