Ticket #4602: test.cpp

File test.cpp, 993 bytes (added by ru.elric@…, 12 years ago)
Line 
1#include <boost/proto/proto.hpp>
2
3namespace proto = boost::proto;
4
5struct start_type {};
6
7struct element_grammar:
8 proto::or_<
9 proto::terminal<char[proto::N]>
10
11 /* Replacing 1 with 0 makes the compilation error disappear. */
12#if 0
13 ,
14 proto::terminal<wchar_t[proto::N]>
15#endif
16 >
17{};
18
19struct grammar:
20 proto::or_<
21 element_grammar,
22 proto::terminal<start_type>,
23 proto::divides<grammar, grammar>
24 >
25{};
26
27template<class Expr>
28struct expression;
29
30struct domain:
31 proto::domain<proto::generator<expression>, grammar>
32{};
33
34template<class Expr>
35struct expression:
36 proto::extends<Expr, expression<Expr>, domain>
37{
38 typedef expression<Expr> this_type;
39
40 typedef
41 proto::extends<Expr, this_type, domain>
42 base_type;
43
44 expression(const Expr &expr = Expr()):
45 base_type(expr)
46 {}
47
48};
49
50expression<proto::terminal<start_type>::type> start;
51
52int main(int argc, char** argv) {
53 auto expr = start / "123";
54}