Modify

Opened 7 years ago

Closed 7 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);
}

Attachments (0)

Change History (3)

comment:1 Changed 7 years ago by chris_kohlhoff

Summary: Read operations incorrectly accept ConstBufferSequencesRead operations incorrectly accept const_buffers_1

comment:2 Changed 7 years ago by chris_kohlhoff

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

comment:3 Changed 7 years ago by chris_kohlhoff

Resolution: fixed
Status: newclosed

Fixed in [66080].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain chris_kohlhoff.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.