Modify

Ticket #7162 (closed Bugs: fixed)

Opened 21 months ago

Last modified 21 months ago

socket streams crash with C++11 enabled; tie(this) no longer legal

Reported by: andrew.c.morrow@… Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

The boost::asio sockets streams classes derive from std::basic_iostream, and then call tie(this)] in the basic_socket_iostream constructor.

In C++11 this is no longer legal (I tried providing a link here, but trac wouldn't let me). The issue is explained here: cplusplus.github.com/LWG/lwg-defects.html#835

Some standard libraries (like libc++) already implement this behavior, and so attempts to use the ASIO socket streams classes cause infinite recursion leading to eventual stack exhaustion and a crash.

I found this issue in boost 1.50.0, but it appears on the boost trunk svn as well so I have filled the ticket against trunk.

Attachments

Change History

comment:1 Changed 21 months ago by chris_kohlhoff

(In [79710]) Instead of using tie(), set the ios_base::unitbuf flag to force the stream to be flushed after every insertion. Refs #7162

comment:2 Changed 21 months ago by chris_kohlhoff

  • Status changed from new to closed
  • Resolution set to fixed

(In [79712]) Merge from trunk:

  • Instead of using tie(), set the ios_base::unitbuf flag to force the stream to be flushed after every insertion. Fixes #7162
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.