Opened 12 years ago

Closed 12 years ago

#4213 closed Patches (fixed)

can't have const value_initialized members

Reported by: Chris Jefferson Owned by: No-Maintainer
Milestone: Boost 1.43.0 Component: utility
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

Code like:

const value_initialized<int> x;

Is invalid in clang and comeau, as they correctly (I believe) reject default initialization of const objects without a user-provided default constructor.

The attached patch adds a default constructor, along with a copy constructor and operator=, just for consistency. It makes clang++ pass all tests for utility, and does not make g++ fail any.

Attachments (1)

value_init.hpp.patch (622 bytes ) - added by Chris Jefferson 12 years ago.
Patch to value_init.hpp

Download all attachments as: .zip

Change History (4)

by Chris Jefferson, 12 years ago

Attachment: value_init.hpp.patch added

Patch to value_init.hpp

comment:1 by niels_dekker, 12 years ago

Component: Noneutility
Owner: set to No-Maintainer
Version: Boost Release BranchBoost Development Trunk

The regression failures were caused by my commit [61883], which reimplemented value_initialized<T> in terms of initialized<T>. See also: [boost] Patch to value_initialized, May 13, 2010.

comment:2 by niels_dekker, 12 years ago

(In [61947]) Hopefully fixed value_initialized compile errors on clang and comeau (strict mode) reported by Christopher Jefferson, see #4213

comment:3 by niels_dekker, 12 years ago

Resolution: fixed
Status: newclosed

While yesterday, the test output of value_init_test had compile errors for clang-darwin-2.0 (error: default initialization of an object of const type 'boost::value_initialized<int> const' requires a user-provided default constructor), this morning the errors are gone. (Looking at http://www.boost.org/development/tests/trunk/developer/utility_.html) So [61947] resolved the issue. Thanks, Chris!

Note: See TracTickets for help on using tickets.