Opened 10 years ago
Closed 10 years ago
#7644 closed Bugs (fixed)
[-Wswitch] warnings with gcc 4.7.2 with C++11 enabled.
| Reported by: | Owned by: | John Maddock | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | regex |
| Version: | Boost 1.52.0 | Severity: | Problem |
| Keywords: | -Wswitch | Cc: |
Description
In file included from ./boost/regex/v4/regex_traits.hpp:39:0,
from ./boost/regex/regex_traits.hpp:27, from ./boost/regex/v4/regex.hpp:39, from ./boost/regex.hpp:31, from libs\regex\build\..\src\winstances.cpp:30:
./boost/regex/v4/cpp_regex_traits.hpp: In instantiation of 'boost::re_detail::parser_buf<charT, traits>::pos_type boost::re_detail::parser_buf<charT, traits>::seekoff(boost::re_detail::parser_buf<charT, traits>::off_type, std::_Iosb<int>::seekdir, std::_Iosb<int>::openmode) [with charT = wchar_t; traits = std::char_traits<wchar_t>; boost::re_detail::parser_buf<charT, traits>::pos_type = std::fpos<_Mbstatet>; boost::re_detail::parser_buf<charT, traits>::off_type = long int; std::_Iosb<int>::seekdir = std::_Iosb<int>::_Seekdir; std::_Iosb<int>::openmode = std::_Iosb<int>::_Openmode]': ./boost/regex/v4/regex_split.hpp:168:1: required from here ./boost/regex/v4/cpp_regex_traits.hpp:117:4: warning: case value '0' not in enumerated type 'std::_Iosb<int>::seekdir {aka std::_Iosb<int>::_Seekdir}' [-Wswitch] ./boost/regex/v4/cpp_regex_traits.hpp:129:4: warning: case value '1' not in enumerated type 'std::_Iosb<int>::seekdir {aka std::_Iosb<int>::_Seekdir}' [-Wswitch] ./boost/regex/v4/cpp_regex_traits.hpp:123:4: warning: case value '2' not in enumerated type 'std::_Iosb<int>::seekdir {aka std::_Iosb<int>::_Seekdir}' [-Wswitch]
Change History (2)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |

ie:
--- a/boost/regex/v4/cpp_regex_traits.hpp +++ b/boost/regex/v4/cpp_regex_traits.hpp @@ -112,7 +112,10 @@ parser_buf<charT, traits>::seekoff(off_type off, ::std::ios_base::seekdir way, : std::ptrdiff_t size = this->egptr() - this->eback(); std::ptrdiff_t pos = this->gptr() - this->eback(); charT* g = this->eback(); - switch(way) + + // cast to avoid gcc '-Wswitch', + // as ios_base::beg/cur/end are not necesssarily values of 'way' enum type ios_base::seekdir + switch(static_cast<int>(way)) { case ::std::ios_base::beg: if((off < 0) || (off > size))}}}