#16 Clang compile error with rapidxml_print.hpp

open
nobody
None
5
2014-07-30
2011-09-22
markh
No

I found that rapidxml_print.hpp would not compile in current clang (llvm C compiler) svn 140288 with a number of complaints along the lines of:

...rapidxml_print.hpp:120:23: error:
call to function 'print_element_node' that is neither visible in the
template definition nor found by argument-dependent lookup
out = print_element_node(out, node, flags, indent);
^
...rapidxml_print.hpp:242:22: note:
'print_element_node' should be declared prior to the call site or in
namespace 'rapidxml'
inline OutIt print_element_node(OutIt out, const xml_node<Ch> ...
^

print_node() is referring to other methods that are not yet defined (they are defined immediately below). I solved this by moving the impl of print_node() down below its brethren print_children(), print_element_node() et al, and put a forward decl of print_node() at the top. My diff attached. The rev numbers in the diff are from my vcs.

Clang appears to be more picky about language rules than gcc, and I rather like that, FWIW.

Thank you for RapidXml.

Discussion

  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-04-05

    Same problem with newer gcc (gcc (GCC) 4.7.0 20120324 (prerelease)) on archlinux
    the patch works
    error is :

    rapidxml-1.13/rapidxml_print.hpp: In instantiation of ‘OutIt rapidxml::internal::print_node(OutIt, const rapidxml::xml_node<Ch>*, int, int) [with OutIt = std::ostream_iterator<char, char, std::char_traits<char> >; Ch = char]’:
    rapidxml-1.13/rapidxml_print.hpp:390:57: required from ‘OutIt rapidxml::print(OutIt, const rapidxml::xml_node<Ch>&, int) [with OutIt = std::ostream_iterator<char, char, std::char_traits<char> >; Ch = char]’
    rapidxml-1.13/rapidxml_print.hpp:403:9: required from ‘std::basic_ostream<Ch>& rapidxml::print(std::basic_ostream<Ch>&, const rapidxml::xml_node<Ch>&, int) [with Ch = char]’
    rapidxml-1.13/rapidxml_print.hpp:414:31: required from ‘std::basic_ostream<Ch>& rapidxml::operator<<(std::basic_ostream<Ch>&, const rapidxml::xml_node<Ch>&) [with Ch = char]’
    src/xmlFactory.cpp:154:10: required from here
    rapidxml-1.13/rapidxml_print.hpp:115:17: error: ‘print_children’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
    rapidxml-1.13/rapidxml_print.hpp:169:22: note: ‘template<class OutIt, class Ch> OutIt rapidxml::internal::print_children(OutIt, const rapidxml::xml_node<Ch>*, int, int)’ declared here, later in the translation unit
    rapidxml-1.13/rapidxml_print.hpp:120:17: error: ‘print_element_node’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
    rapidxml-1.13/rapidxml_print.hpp:242:22: note: ‘template<class OutIt, class Ch> OutIt rapidxml::internal::print_element_node(OutIt, const rapidxml::xml_node<Ch>*, int, int)’ declared here, later in the translation unit
    rapidxml-1.13/rapidxml_print.hpp:125:17: error: ‘print_data_node’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
    rapidxml-1.13/rapidxml_print.hpp:208:22: note: ‘template<class OutIt, class Ch> OutIt rapidxml::internal::print_data_node(OutIt, const rapidxml::xml_node<Ch>*, int, int)’ declared here, later in the translation unit
    rapidxml-1.13/rapidxml_print.hpp:130:17: error: ‘print_cdata_node’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
    rapidxml-1.13/rapidxml_print.hpp:219:22: note: ‘template<class OutIt, class Ch> OutIt rapidxml::internal::print_cdata_node(OutIt, const rapidxml::xml_node<Ch>*, int, int)’ declared here, later in the translation unit
    rapidxml-1.13/rapidxml_print.hpp:135:17: error: ‘print_declaration_node’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
    rapidxml-1.13/rapidxml_print.hpp:298:22: note: ‘template<class OutIt, class Ch> OutIt rapidxml::internal::print_declaration_node(OutIt, const rapidxml::xml_node<Ch>*, int, int)’ declared here, later in the translation unit
    rapidxml-1.13/rapidxml_print.hpp:140:17: error: ‘print_comment_node’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
    rapidxml-1.13/rapidxml_print.hpp:321:22: note: ‘template<class OutIt, class Ch> OutIt rapidxml::internal::print_comment_node(OutIt, const rapidxml::xml_node<Ch>*, int, int)’ declared here, later in the translation unit
    rapidxml-1.13/rapidxml_print.hpp:145:17: error: ‘print_doctype_node’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
    rapidxml-1.13/rapidxml_print.hpp:339:22: note: ‘template<class OutIt, class Ch> OutIt rapidxml::internal::print_doctype_node(OutIt, const rapidxml::xml_node<Ch>*, int, int)’ declared here, later in the translation unit
    rapidxml-1.13/rapidxml_print.hpp:150:17: error: ‘print_pi_node’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
    rapidxml-1.13/rapidxml_print.hpp:361:22: note: ‘template<class OutIt, class Ch> OutIt rapidxml::internal::print_pi_node(OutIt, const rapidxml::xml_node<Ch>*, int, int)’ declared here, later in the translation unit

     
    Last edit: Anonymous 2017-07-06

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks