1 /* 2 Copyright 2018 Glen Joseph Fernandes 3 ([email protected]) 4 5 Distributed under the Boost Software License, Version 1.0. 6 (http://www.boost.org/LICENSE_1_0.txt) 7 */ 8 #include <boost/config.hpp> 9 #if !defined(BOOST_NO_CXX11_FINAL) 10 #include <boost/compressed_pair.hpp> 11 #include <boost/core/lightweight_test.hpp> 12 13 struct type1 { operator booltype114 operator bool() const { 15 return false; 16 } 17 }; 18 19 struct type2 final { operator booltype220 operator bool() const { 21 return false; 22 } 23 }; 24 25 #if !defined(BOOST_IS_FINAL) 26 namespace boost { 27 28 template<> 29 struct is_final<type2> 30 : true_type { }; 31 32 } /* boost*/ 33 #endif 34 35 template<class T1, class T2> test()36void test() 37 { 38 boost::compressed_pair<T1, T2> p; 39 BOOST_TEST(!p.first()); 40 BOOST_TEST(!p.second()); 41 } 42 main()43int main() 44 { 45 test<type1, type2>(); 46 test<type2, type1>(); 47 test<type2, type2>(); 48 return boost::report_errors(); 49 } 50 #else main()51int main() 52 { 53 return 0; 54 } 55 #endif 56