Opened 5 years ago

Last modified 4 years ago

#13368 new Bugs

consuming_buffers.hpp: parse error in template argument list

Reported by: anonymous Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.66.0 Severity: Regression
Keywords: Cc:

Description

.../boost/boost/boost/asio/detail/consuming_buffers.hpp: In member function ‘boost::asio::detail::consuming_buffers<Buffer, Buffers, Buffer_Iterator>::prepared_buffers_type boost::asio::detail::consuming_buffers<Buffer, Buffers, Buffer_Iterator>::prepare(std::size_t)’:
.../boost/boost/boost/asio/detail/consuming_buffers.hpp:105:50: erreur: parse error in template argument list
     while (next != end && max_size > 0 && result.count < result.max_buffers)
                                                  ^

Context: Upgrade from 1_65_1 to 1_66

  • Ubuntu 16.04 LTS / g++ v 5.4.0
  • CentOS 7 / g++ v 4.8.5

Change History (7)

comment:1 by sami.elhini@…, 5 years ago

I am also seeing this error with 1_54_0.

comment:2 by anonymous, 5 years ago

I think I know the issue. You have to make sure that if you update the libs you also update the headers. I compiled 1_66 and installed it using b2. I needed 1_54. I deleted the libs under /usr/local/lib (default install location, you may have chosen a different location) but not the headers under /usr/local/include/boost.

When I deleted both libs and headers and reinstalled this error went away.

comment:3 by Anton Kryukov <akryukov@…>, 5 years ago

I am having the same problem using gcc 4.8.4 on 14.04.1-Ubuntu. I installed boost 1.66 in a separate directory next to the previously installed boost 1.57 and pointed to it using environment variables. I recreated our build tree using CMake in a pristine directory and got this error:


In file included from .../boost_1_66_0/boost/asio/impl/write.hpp:25:0,

from .../boost_1_66_0/boost/asio/write.hpp:927,

from .../boost_1_66_0/boost/asio/buffered_write_stream.hpp:29,

from .../boost_1_66_0/boost/asio/buffered_stream.hpp:22,

from .../boost_1_66_0/boost/asio.hpp:41,

from .../.../stdafx.h:39,

from .../.../xxx.cpp:1:

.../boost_1_66_0/boost/asio/detail/consuming_buffers.hpp: In member function ‘boost::asio::detail::consuming_buffers<Buffer, Buffers, Buffer_Iterator>::prepared_buffers_type boost::asio::detail::consuming_buffers<Buffer, Buffers, Buffer_Iterator>::prepare(std::size_t)’:

.../boost_1_66_0/boost/asio/detail/consuming_buffers.hpp:105:50: error: parse error in template argument list

while (next != end && max_size > 0 && result.count < result.max_buffers)


In the stdafx.h file asio.hpp was #included after a bunch of other boost headers (and nothing else):

#include <boost/noncopyable.hpp>

#include <boost/function.hpp>

#include <boost/format.hpp>

#include <boost/shared_ptr.hpp>

#include <boost/scoped_ptr.hpp>

#include <boost/foreach.hpp>

#include <boost/bind.hpp>

#include <boost/serialization/strong_typedef.hpp>

#include <boost/range/algorithm.hpp>

#include <boost/algorithm/string/predicate.hpp>

#include <boost/lexical_cast.hpp>

#include <boost/intrusive_ptr.hpp>

#include <boost/variant.hpp>

#include <boost/asio.hpp>

When I moved #include <boost/asio.hpp> to the front, the problem went away. Visual C++ 14.1 did not have this problem.

comment:4 by awulkiew, 5 years ago

FYI, it seems that the code is somehow interfering with boost::count. To reproduce it you only need:

#include <boost/range/algorithm/count.hpp>
#include <boost/asio/detail/consuming_buffers.hpp>

int main()
{}

It also affects Boost.Geometry (#13386).

comment:5 by anonymous, 5 years ago

I followed this link and updated g++ from 5 to 6 and it solved the problem on ubuntu:

https://github.com/domoticz/domoticz/issues/2034

comment:6 by anonymous, 5 years ago

Patch proposed in the same github discussion worked for me (gcc 5.4.0).

--- a/boost/asio/detail/consuming_buffers.hpp
+++ b/boost/asio/detail/consuming_buffers.hpp
@@ -102,7 +102,7 @@ public:

     std::advance(next, next_elem_);
     std::size_t elem_offset = next_elem_offset_;
-    while (next != end && max_size > 0 && result.count < result.max_buffers)
+    while (next != end && max_size > 0 && (result.count) < result.max_buffers)
     {
       Buffer next_buf = Buffer(*next) + elem_offset;
       result.elems[result.count] = boost::asio::buffer(next_buf, max_size);

in reply to:  6 comment:7 by chaitanya.pinninti@…, 4 years ago

This worked for me.

Replying to anonymous:

Patch proposed in the same github discussion worked for me (gcc 5.4.0).

--- a/boost/asio/detail/consuming_buffers.hpp
+++ b/boost/asio/detail/consuming_buffers.hpp
@@ -102,7 +102,7 @@ public:

     std::advance(next, next_elem_);
     std::size_t elem_offset = next_elem_offset_;
-    while (next != end && max_size > 0 && result.count < result.max_buffers)
+    while (next != end && max_size > 0 && (result.count) < result.max_buffers)
     {
       Buffer next_buf = Buffer(*next) + elem_offset;
       result.elems[result.count] = boost::asio::buffer(next_buf, max_size);
Note: See TracTickets for help on using tickets.