attr_functor_void_return.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright Andrey Semashev 2007 - 2015.
  3. * Distributed under the Boost Software License, Version 1.0.
  4. * (See accompanying file LICENSE_1_0.txt or copy at
  5. * http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. /*!
  8. * \file attr_functor_void_return.cpp
  9. * \author Andrey Semashev
  10. * \date 25.01.2009
  11. *
  12. * \brief This test checks that it is not possible to create a functor attribute
  13. * with a void-returning functor.
  14. */
  15. #define BOOST_TEST_MODULE attr_functor_void_return
  16. #include <boost/utility/result_of.hpp>
  17. #include <boost/log/attributes/attribute.hpp>
  18. #include <boost/log/attributes/function.hpp>
  19. namespace logging = boost::log;
  20. namespace attrs = logging::attributes;
  21. namespace {
  22. // A test function that returns an attribute value
  23. void get_attr_value() {}
  24. } // namespace
  25. int main(int, char*[])
  26. {
  27. logging::attribute attr1 =
  28. #ifndef BOOST_NO_RESULT_OF
  29. attrs::make_function(&get_attr_value);
  30. #else
  31. attrs::make_function< void >(&get_attr_value);
  32. #endif
  33. return 0;
  34. }