// Copyright David Abrahams 2003. // 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 #include #include using boost::implicit_cast; using boost::type; template type check_return(T) { return type(); } struct foo { foo(char const*) {} operator long() const { return 0; } }; typedef type long_type; typedef type foo_type; int main() { type x = check_return(boost::implicit_cast(1)); BOOST_TEST(boost::implicit_cast(1) == 1L); type f = check_return(boost::implicit_cast("hello")); type z = check_return(boost::implicit_cast(foo("hello"))); // warning suppression: (void)x; (void)f; (void)z; return boost::report_errors(); }