Opened 8 years ago

Closed 8 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:


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.async_read_some(cb1, handler);

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

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

Change History (3)

comment:1 Changed 8 years ago by chris_kohlhoff

Summary: Read operations incorrectly accept ConstBufferSequencesRead operations incorrectly accept const_buffers_1

comment:2 Changed 8 years ago by chris_kohlhoff

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

comment:3 Changed 8 years ago by chris_kohlhoff

Resolution: fixed
Status: newclosed

Fixed in [66080].

Note: See TracTickets for help on using tickets.