Modify

Opened 5 years ago

Closed 5 years ago

#7162 closed Bugs (fixed)

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 (0)

Change History (2)

comment:1 Changed 5 years 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 5 years ago by chris_kohlhoff

Resolution: fixed
Status: newclosed

(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

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.