[Boost-bugs] [Boost C++ Libraries] #1480: Boost:::Spirit bug in tree_to_xml.ipp

Subject: [Boost-bugs] [Boost C++ Libraries] #1480: Boost:::Spirit bug in tree_to_xml.ipp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-11-28 08:24:10


#1480: Boost:::Spirit bug in tree_to_xml.ipp
-----------------------+----------------------------------------------------
 Reporter: anonymous | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.34.1
 Severity: Problem | Keywords:
-----------------------+----------------------------------------------------
 Following code from head revision of boost::spirit(boost repository)
 generate error.

 #define UNICODE
 #define _UNICODE

 #include <tchar.h>

 #include <boost/spirit/core.hpp>
 #include <boost/spirit/tree/ast.hpp>
 #include <boost/spirit/tree/tree_to_xml.hpp>
 #include "tree_calc_grammar.hpp"

 #include <iostream>
 #include <fstream>
 #include <string>

 using namespace std;
 using namespace boost::spirit;

 #ifdef _UNICODE
 typedef wchar_t char_t;
 #else
 typedef char char_t;
 #endif

 typedef std::basic_string<char_t>::iterator iterator_t;
 typedef tree_match<iterator_t> parse_tree_match_t;
 typedef parse_tree_match_t::tree_iterator iter_t;

 int main()
 {
     std::basic_string<char_t> input(_TEXT("1+2"));
     calculator calc;
     tree_parse_info<iterator_t> ast_info = ast_parse(
 iterator_t(input.begin()),
 iterator_t(input.end()),
                                                         calc >> end_p,
                                                         space_p);
     std::wcout << ((ast_info.full) ? _TEXT("Full") : _TEXT("Not full")) <<
 std::endl;
     std::basic_fstream<char_t> file;
     file.open(_TEXT("output.xml"), std::ios_base::out);
     basic_tree_to_xml<char_t>(file, ast_info.trees, input);
     return 0;
 }

 For building I use VC8.0 and it gives errors:

 1>c:\work\boost\boost_lv\boost\spirit\tree\impl\tree_to_xml.ipp(482) :
 error C2664:
 'boost::spirit::xml::document<CharT>::document(std::basic_ostream<_Elem,_Traits>
 &,const CharT *,const CharT *)' : cannot convert parameter 2 from
 'std::wstring' to 'const char_t *'
 1> with
 1> [
 1> CharT=char_t,
 1> _Elem=wchar_t,
 1> _Traits=std::char_traits<wchar_t>
 1> ]
 1> No user-defined-conversion operator available that can perform
 this conversion, or the operator cannot be called

 I fixed some bugs in tree_to_xml.ipp and check basic_tree_to_xml() on my
 tests, it seems work right.
 You can download it http://webfile.ru/1616184

 --
 Best Regards,
 Kudiyarov Roman.

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1480>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC