| 1 | // Copyright (c) 2010 Josh Wilson |
| 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 | |
| 7 | #include <boost/spirit/include/qi.hpp> |
| 8 | #include <boost/fusion/include/adapt_struct.hpp> |
| 9 | #include <boost/variant.hpp> |
| 10 | #include <string> |
| 11 | |
| 12 | namespace qi = boost::spirit::qi; |
| 13 | |
| 14 | /////////////////////////////////////////////////////////////////////////////// |
| 15 | struct Number { float base; }; |
| 16 | |
| 17 | BOOST_FUSION_ADAPT_STRUCT( Number, (float, base) ) |
| 18 | |
| 19 | void instantiate1() |
| 20 | { |
| 21 | qi::symbols<char, Number> sym; |
| 22 | qi::rule<std::string::const_iterator, Number()> rule; |
| 23 | rule %= sym; // Caused compiler error after getting r61322 |
| 24 | } |
| 25 | |
| 26 | /////////////////////////////////////////////////////////////////////////////// |
| 27 | typedef boost::variant<int, float> internal_type; |
| 28 | |
| 29 | struct Number2 { internal_type base; }; |
| 30 | |
| 31 | BOOST_FUSION_ADAPT_STRUCT( Number2, (internal_type, base) ) |
| 32 | |
| 33 | void instantiate2() |
| 34 | { |
| 35 | qi::symbols<char, Number2> sym; |
| 36 | qi::rule<std::string::const_iterator, Number2()> rule; |
| 37 | rule %= sym; // Caused compiler error after getting r61322 |
| 38 | } |
| 39 | |
| 40 | |