[Xapian-tickets] [Xapian] #377: MSVC 9.0 warning in xapian-core/common/str.h

Xapian nobody at xapian.org
Wed May 20 10:47:05 BST 2009


#377: MSVC 9.0 warning in xapian-core/common/str.h
--------------------+-------------------------------------------------------
 Reporter:  kelm    |       Owner:  olly             
     Type:  defect  |      Status:  new              
 Priority:  normal  |   Milestone:                   
Component:  Other   |     Version:  SVN trunk        
 Severity:  normal  |    Keywords:                   
Blockedby:          |    Platform:  Microsoft Windows
 Blocking:          |  
--------------------+-------------------------------------------------------
 MSVC 9.0 complains about line 74 in "xapian-core/common/str.h":


 {{{
 inline std::string str(bool value) { return std::string(1, '0' | value); }
 }}}


 with the (bogus) message:

 "warning C4806: '|' : unsafe operation: no value of type 'bool' promoted
 to type 'char' can equal the given constant"

 Proposed resolution is to convert "value" to a "char" via static_cast:


 {{{
 inline std::string str(bool value) { return std::string(1, '0' |
 static_cast<char>(value)); }
 }}}

-- 
Ticket URL: <http://trac.xapian.org/ticket/377>
Xapian <http://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list