Boost logo

Boost Users :

Subject: [Boost-users] [utility] Anyone here using Intel 9.0 compiler + value_initialized?
From: Niels Dekker - address until 2010-10-10 (niels_address_until_2010-10-10_at_[hidden])
Date: 2009-07-04 08:13:30


boost::value_initialized<T>, as included with the release version of
Boost (current version: 1.39.0), has a conversion operator that breaks
the principle of "logical constness": The member function itself is
"const", but it returns a non-const reference to the data, T&.

Four months ago, I fixed this issue on the development trunk [51355],
replacing the conversion operator by a const and a non-const overload.
The const overload returns a const reference to the data. (Ticket
#2548.) After this fix, one specific version of a compiler yielded some
compiler errors at the regression page: Intel 9.0

In fact it only yielded two compiler errors: only for implicitly
conversions from value_initialized<NonPOD*>, and const
value_initialized<NonPOD*>. Other conversions went well, for example,
from const value_initialized<int> to const int&.

Now I wonder, because Intel 9.0 is an old compiler version, and the
regression failure occurs only in a very specific case, would it be
acceptable to leave the fix in there, and have it shipped with an
upcoming release version of Boost? Is anyone here likely to use the
next version of Boost, including value_initialized<T>, on Intel 9.0? If
so, would you find it acceptable to retrieve a reference to the data
from value_initialized<T> by using the value_initialized::data() member
function, or boost::get, instead of depending on implicit conversion?

Note: Five days ago I committed a workaround for Intel 9.0 to the trunk
[54502], removing the const-version of the overload. But it yielded
many more Intel 9.0 errors (33!), as expected, on any attempt to convert
a const value_initialized<T>. So does anyone here think this workaround
is still useful?

References:

Ticket #2548, "Let's fix the logical constness of value_initialized!"
https://svn.boost.org/trac/boost/ticket/2548

Utility/trunk regression page:
www.boost.org/development/tests/trunk/developer/utility_.html

[51355] Fix at the development trunk (4 months ago):
https://svn.boost.org/trac/boost/changeset/51355

[54502] Intel 9.0 specific workaround (5 days ago):
https://svn.boost.org/trac/boost/changeset/54502

Kind regards,

-- 
Niels Dekker
http://www.xs4all.nl/~nd/dekkerware
Scientific programmer at LKEB, Leiden University Medical Center

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net