]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/spirit/test/karma/grammar_fail.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / spirit / test / karma / grammar_fail.cpp
CommitLineData
7c673cae
FG
1/*=============================================================================
2 Copyright (c) 2001-2011 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=============================================================================*/
7c673cae
FG
7#include <boost/spirit/include/karma_operator.hpp>
8#include <boost/spirit/include/karma_char.hpp>
9#include <boost/spirit/include/karma_string.hpp>
10#include <boost/spirit/include/karma_numeric.hpp>
11#include <boost/spirit/include/karma_nonterminal.hpp>
12#include <boost/spirit/include/karma_generate.hpp>
13
14#include "test.hpp"
15
16using namespace boost::spirit;
17using namespace boost::spirit::ascii;
18
19typedef spirit_test::output_iterator<char>::type outiter_type;
20
21struct num_list : karma::grammar<outiter_type, karma::rule<outiter_type> >
22{
23 num_list() : num_list::base_type(start)
24 {
25 start = int_(1) << ',' << int_(0);
26 }
27
28 karma::rule<outiter_type, karma::rule<outiter_type> > start;
29};
30
31// this test must fail compiling as the rule is used with an incompatible
32// delimiter type
33int main()
34{
35 std::string generated;
36
37 std::back_insert_iterator<std::string> outit(generated);
38 num_list def;
39 generate_delimited(outit, def, char_('%') << '\n');
40
41 return 0;
42}