regression_semantic_action_attribute.cpp 1016 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright (c) 2010 Michael Caisse
  2. // Copyright (c) 2001-2010 Hartmut Kaiser
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. #include <boost/config/warning_disable.hpp>
  7. #include <boost/detail/lightweight_test.hpp>
  8. #include <string>
  9. #include <vector>
  10. #include <boost/spirit/include/karma.hpp>
  11. #include <boost/spirit/include/phoenix_core.hpp>
  12. #include <boost/spirit/include/phoenix_operator.hpp>
  13. #include "test.hpp"
  14. using namespace spirit_test;
  15. namespace karma = boost::spirit::karma;
  16. namespace phx = boost::phoenix;
  17. int main()
  18. {
  19. using karma::int_;
  20. using karma::_1;
  21. BOOST_TEST(test("16909060", int_[ _1 = phx::val(0x01020304) ]));
  22. // make sure the passed attribute type does not enforce the attribute type
  23. // for the semantic action
  24. unsigned char char_value = 8;
  25. BOOST_TEST(test("16909060", int_[ _1 = phx::val(0x01020304) ], char_value));
  26. return boost::report_errors();
  27. }