regression_one_element_sequence_attribute.cpp 1.2 KB

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