implicit_cast_fail.cpp 425 B

1234567891011121314151617181920
  1. // Copyright David Abrahams 2003.
  2. // Distributed under the Boost Software License, Version 1.0. (See
  3. // accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #include <boost/implicit_cast.hpp>
  6. using boost::implicit_cast;
  7. struct foo
  8. {
  9. explicit foo(char const*) {}
  10. };
  11. int main()
  12. {
  13. foo x = implicit_cast<foo>("foobar");
  14. (void)x; // warning suppression.
  15. return 0;
  16. }