senjuhashirama / pugixml

Automatically exported from code.google.com/p/pugixml
0 stars 0 forks source link

Cannot compile foreach.hpp header #240

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

- Install Boost 1.54 and make your compiler include it
- Move src/pugixml.hpp, src/pugiconfig.hpp and contrib/foreach.hpp to a folder 
along with the following code:

{{{
#include <boost/foreach.hpp>
#include "foreach.hpp"

int main() {
    return 0;
}
}}}

- Try to compile the above code

What is the expected output? What do you see instead?

Expected is a successful compilation. Instead I get the error

{{{
In file included from test.cpp:2:0:
foreach.hpp:20:29: error: redeclared with 1 template parameter
  template <typename> struct range_mutable_iterator;
                             ^
In file included from /usr/include/boost/range/iterator.hpp:19:0,
                 from /usr/include/boost/range/end.hpp:25,
                 from /usr/include/boost/foreach.hpp:73,
                 from test.cpp:1:
/usr/include/boost/range/range_fwd.hpp:21:12: note: previous declaration 
'template<class C, class Enabler> struct boost::range_mutable_iterator' used 2 
template parameters
     struct range_mutable_iterator;
            ^
In file included from test.cpp:2:0:
foreach.hpp:21:29: error: redeclared with 1 template parameter
  template <typename> struct range_const_iterator;
                             ^
In file included from /usr/include/boost/range/iterator.hpp:19:0,
                 from /usr/include/boost/range/end.hpp:25,
                 from /usr/include/boost/foreach.hpp:73,
                 from test.cpp:1:
/usr/include/boost/range/range_fwd.hpp:24:12: note: previous declaration 
'template<class C, class Enabler> struct boost::range_const_iterator' used 2 
template parameters
     struct range_const_iterator;
}}}

Which version of pugixml are you using? On what operating system/compiler?

Pugixml 1.4
g++ (GCC) 4.9.1 20140903 (prerelease)
Arch Linux

Please provide any additional information below.

-

Original issue reported on code.google.com by christia...@gmail.com on 25 Sep 2014 at 12:28

GoogleCodeExporter commented 9 years ago
Changing line 20 and 21 of contrib/foreach.hpp to

    template <typename, typename> struct range_mutable_iterator;
    template <typename, typename> struct range_const_iterator;

solves the problem for me.

Original comment by christia...@gmail.com on 25 Sep 2014 at 12:39

GoogleCodeExporter commented 9 years ago
Do you mean Boost 1.56? foreach.hpp compiles and works for me for 1.54 and 
1.55, but 1.56 seems to have changed the range iterator classes.

Original comment by arseny.k...@gmail.com on 27 Sep 2014 at 4:35

GoogleCodeExporter commented 9 years ago
Fixed in r1026

Original comment by arseny.k...@gmail.com on 27 Sep 2014 at 4:50

GoogleCodeExporter commented 9 years ago
Yes, sorry I meant Boost 1.56, and I can confirm that this was fixed in r1026.
Thanks!

Original comment by christia...@gmail.com on 27 Sep 2014 at 3:45