1 //Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. 2 3 //Distributed under the Boost Software License, Version 1.0. (See accompanying 4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 6 #include <boost/exception/get_error_info.hpp> 7 #include <boost/exception/info.hpp> 8 #include <boost/detail/lightweight_test.hpp> 9 #include <boost/detail/workaround.hpp> 10 #include <errno.h> 11 12 typedef boost::error_info<struct tag_errno,int> info_errno; 13 14 class 15 my_exception: 16 public boost::exception 17 { 18 }; 19 20 int main()21main() 22 { 23 try 24 { 25 errno=1; 26 throw my_exception() << info_errno(errno); 27 } 28 catch( 29 my_exception & x ) 30 { 31 BOOST_TEST(1==*boost::get_error_info<info_errno>(x)); 32 } 33 return boost::report_errors(); 34 } 35