// protect_test2.cpp // // Copyright 2020 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #include #include #include template void test( F ) { BOOST_TEST_TRAIT_TRUE((boost::core::is_same)); } struct X { struct result_type {}; }; struct Y { }; template struct inherit: T, U { }; template void test2( F ) { // test that F doesn't have ::result_type BOOST_TEST_TRAIT_TRUE((boost::core::is_same::result_type, typename X::result_type>)); } int main() { test( boost::protect( X() ) ); #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !(defined(BOOST_GCC) && BOOST_GCC < 40600) test2( boost::protect( Y() ) ); #endif return boost::report_errors(); }