Opened 12 years ago

Closed 12 years ago

#4746 closed Bugs (fixed)

Read operations incorrectly accept const_buffers_1

Reported by: chris_kohlhoff Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc:

Description

In Asio 1.4.6 / Boost 1.44, following program compiles when it shouldn't:

#include <boost/asio.hpp>
#include <string>
#include <vector>

void handler(boost::system::error_code, std::size_t) {}

int main()
{
  boost::asio::io_service io_service;
  boost::asio::ip::tcp::socket sock(io_service);

  boost::asio::const_buffers_1 cb1(0, 0);
  sock.read_some(cb1);
  sock.async_read_some(cb1, handler);

  std::string s;
  sock.read_some(boost::asio::buffer(s));
  sock.async_read_some(boost::asio::buffer(s), handler);

  const std::vector<char> v;
  sock.read_some(boost::asio::buffer(v));
  sock.async_read_some(boost::asio::buffer(v), handler);
}

Change History (3)

comment:1 by chris_kohlhoff, 12 years ago

Summary: Read operations incorrectly accept ConstBufferSequencesRead operations incorrectly accept const_buffers_1

comment:2 by chris_kohlhoff, 12 years ago

(In [66056]) Fix so that read operations do not accept const_buffers_1 arguments. Refs #4746.

comment:3 by chris_kohlhoff, 12 years ago

Resolution: fixed
Status: newclosed

Fixed in [66080].

Note: See TracTickets for help on using tickets.