Boost logo

Boost-Commit :

From: bdawes_at_[hidden]
Date: 2007-09-13 17:47:25


Author: bemandawes
Date: 2007-09-13 17:47:25 EDT (Thu, 13 Sep 2007)
New Revision: 39248
URL: http://svn.boost.org/trac/boost/changeset/39248

Log:
Ensure error_category::operator< test works regardless of how compiler lays out memory.
Text files modified:
   trunk/libs/system/test/error_code_test.cpp | 15 +++++++++++++--
   1 files changed, 13 insertions(+), 2 deletions(-)

Modified: trunk/libs/system/test/error_code_test.cpp
==============================================================================
--- trunk/libs/system/test/error_code_test.cpp (original)
+++ trunk/libs/system/test/error_code_test.cpp 2007-09-13 17:47:25 EDT (Thu, 13 Sep 2007)
@@ -24,6 +24,7 @@
 #include <sstream>
 #include <string>
 #include <cstring>
+#include <functional>
 #include <boost/cerrno.hpp>
 
 // Although using directives are not the best programming practice, testing
@@ -66,8 +67,18 @@
   BOOST_CHECK( system_category == system_category );
   BOOST_CHECK( posix_category != system_category );
   BOOST_CHECK( system_category != posix_category );
- BOOST_CHECK( posix_category < system_category );
- BOOST_CHECK( !(system_category < posix_category) );
+
+ if ( std::less<const error_category*>()( &posix_category, &system_category ) )
+ {
+ BOOST_CHECK( posix_category < system_category );
+ BOOST_CHECK( !(system_category < posix_category) );
+ }
+ else
+ {
+ BOOST_CHECK( system_category < posix_category );
+ BOOST_CHECK( !(posix_category < system_category) );
+ }
+
 
   error_code ec;
   error_condition dec;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk