Modify

Opened 5 years ago

Closed 5 years ago

#6871 closed Bugs (wontfix)

chrono_io.hpp: operator<<(ostream& os, ...) modifies the state of os

Reported by: vkh@… Owned by: viboes
Milestone: Boost 1.52.0 Component: chrono
Version: Boost 1.47.0 Severity: Problem
Keywords: Cc:

Description

The code

std::locale loc = os.getloc(); if (!std::has_facet<Facet>(loc))

os.imbue(std::locale(loc, new Facet));

causes the state of os to be changed. It requires the CLIENT code to do own locale saving, like in {

boost::io::ios_locale_saver loc(std::cout); std::cout << boost::chrono::system_clock::now() << std::endl;

}

Compare this to stream io code in boost/date_time (e.g., gregorian_io.hpp), that begins with a (correct)

boost::io::ios_flags_saver iflags(os);

Please fix chrono to behave similarly.

Discovered with 1.47.0 in chrono/chrono_io.hpp, but also exists on the trunk in chrono/io_v1/chrono_io.hpp.

Attachments (0)

Change History (6)

comment:1 Changed 5 years ago by viboes

I'm reworking the chrono io for version v2 which uses ios_base states instead of locale facets. Could you check if the version 2 solves the issue?

comment:2 Changed 5 years ago by viboes

  • Status changed from new to assigned

comment:3 Changed 5 years ago by viboes

  • Milestone changed from To Be Determined to Boost 1.52.0
  • Version changed from Boost Development Trunk to Boost 1.47.0

comment:4 Changed 5 years ago by viboes

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

The issue is solved moving to version 2. You should define BOOST_CHRONO_VERSION=2.

Merged to release [80424][80430][80471].

comment:5 Changed 5 years ago by viboes

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:6 Changed 5 years ago by viboes

  • Resolution set to wontfix
  • Status changed from reopened to closed

I have no fix for io version 1. You should move to version 2.

Last edited 5 years ago by viboes (previous) (diff)

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain viboes.
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.