[Boost-bugs] [Boost C++ Libraries] #4714: boost::tokenizer_detail::traits_extension does not expose correctly std::_Secure_char_traits_tag on VC9

Subject: [Boost-bugs] [Boost C++ Libraries] #4714: boost::tokenizer_detail::traits_extension does not expose correctly std::_Secure_char_traits_tag on VC9
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-10-05 12:35:56


#4714: boost::tokenizer_detail::traits_extension does not expose correctly
std::_Secure_char_traits_tag on VC9
--------------------------------+-------------------------------------------
 Reporter: emilm@… | Owner: jsiek
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: tokenizer
  Version: Boost 1.44.0 | Severity: Problem
 Keywords: |
--------------------------------+-------------------------------------------
 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)

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4714>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:04 UTC