Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55744 - in trunk: boost/exception libs/exception/test
From: emil_at_[hidden]
Date: 2009-08-23 18:34:20


Author: emildotchevski
Date: 2009-08-23 18:34:19 EDT (Sun, 23 Aug 2009)
New Revision: 55744
URL: http://svn.boost.org/trac/boost/changeset/55744

Log:
fixing compile errors with some compilers
Added:
   trunk/libs/exception/test/error_info_const_fail.cpp (contents, props changed)
Text files modified:
   trunk/boost/exception/get_error_info.hpp | 26 +++++++++++++++-----------
   trunk/libs/exception/test/Jamfile.v2 | 1 +
   2 files changed, 16 insertions(+), 11 deletions(-)

Modified: trunk/boost/exception/get_error_info.hpp
==============================================================================
--- trunk/boost/exception/get_error_info.hpp (original)
+++ trunk/boost/exception/get_error_info.hpp 2009-08-23 18:34:19 EDT (Sun, 23 Aug 2009)
@@ -73,6 +73,20 @@
                 return x.throw_line_!=-1 ? &x.throw_line_ : 0;
                 }
             };
+
+ template <class T,class R>
+ struct
+ get_error_info_return_type
+ {
+ typedef R * type;
+ };
+
+ template <class T,class R>
+ struct
+ get_error_info_return_type<T const,R>
+ {
+ typedef R const * type;
+ };
         }
 
 #ifdef BOOST_NO_RTTI
@@ -93,17 +107,7 @@
 #else
     template <class ErrorInfo,class E>
     inline
- typename ErrorInfo::value_type const *
- get_error_info( E const & some_exception )
- {
- if( exception const * x = dynamic_cast<exception const *>(&some_exception) )
- return exception_detail::get_info<ErrorInfo>::get(*x);
- else
- return 0;
- }
- template <class ErrorInfo,class E>
- inline
- typename ErrorInfo::value_type *
+ typename exception_detail::get_error_info_return_type<E,typename ErrorInfo::value_type>::type
     get_error_info( E & some_exception )
         {
         if( exception const * x = dynamic_cast<exception const *>(&some_exception) )

Modified: trunk/libs/exception/test/Jamfile.v2
==============================================================================
--- trunk/libs/exception/test/Jamfile.v2 (original)
+++ trunk/libs/exception/test/Jamfile.v2 2009-08-23 18:34:19 EDT (Sun, 23 Aug 2009)
@@ -38,6 +38,7 @@
 run errinfos_test.cpp ;
 compile-fail exception_fail.cpp ;
 compile-fail throw_exception_fail.cpp ;
+compile-fail error_info_const_fail.cpp ;
 
 #headers
 

Added: trunk/libs/exception/test/error_info_const_fail.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/exception/test/error_info_const_fail.cpp 2009-08-23 18:34:19 EDT (Sun, 23 Aug 2009)
@@ -0,0 +1,14 @@
+//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
+
+//Distributed under the Boost Software License, Version 1.0. (See accompanying
+//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/exception/get_error_info.hpp>
+
+typedef boost::error_info<struct foo_,int> foo;
+
+void
+test( boost::exception const * e )
+ {
+ ++*boost::get_error_info<foo>(*e);
+ }


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