rule_fail.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Hartmut Kaiser
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. =============================================================================*/
  6. #include <boost/config/warning_disable.hpp>
  7. #include <boost/spirit/include/karma_operator.hpp>
  8. #include <boost/spirit/include/karma_char.hpp>
  9. #include <boost/spirit/include/karma_numeric.hpp>
  10. #include <boost/spirit/include/karma_nonterminal.hpp>
  11. #include <boost/spirit/include/karma_generate.hpp>
  12. #include <boost/function_output_iterator.hpp>
  13. #include "test.hpp"
  14. using namespace boost::spirit;
  15. using namespace boost::spirit::ascii;
  16. // this test must fail compiling as the rule is used with an incompatible
  17. // delimiter type
  18. int main()
  19. {
  20. typedef spirit_test::output_iterator<char>::type outiter_type;
  21. std::string generated;
  22. karma::rule<outiter_type, karma::rule<outiter_type> > def;
  23. def = int_(1) << ',' << int_(0);
  24. std::back_insert_iterator<std::string> outit(generated);
  25. generate_delimited(outit, def, char_('%') << '\n');
  26. return 0;
  27. }