Boost logo

Boost :

From: Paul A Bristow (pbristow_at_[hidden])
Date: 2007-10-15 10:23:22


>-----Original Message-----
>From: boost-bounces_at_[hidden]
>[mailto:boost-bounces_at_[hidden]] On Behalf Of Niels
>Dekker - mail address until 2008-12-31
>Sent: 15 October 2007 13:00
>To: boost_at_[hidden]
>Subject: Re: [boost] [utility] value_init warning
>Gennadiy Rozental wrote:
>> I am building trunk version of Boost.Test with msvc 8.0 and
>> see following warning:
>> ..\..\..\boost/utility/value_init.hpp(73) : warning C4345:
>> behavior change: an object of POD type constructed with
>> an initializer of the form () will be default-initialized
>I guess the warning is caused by an MSVC-specific workaround that I
>committed to trunk/boost/utility/value_init.hpp, September 7, [39157].
>My apologizes!
>The MSVC warning is about the following line of code:
> new (&x) T();
>This line of code looks perfectly fine to me! The warning
>just tells us
>that when T is a POD struct, the newly created object will be
>As it should! Note that MSVC 7.1 produces the very same
>warning, so it
>isn't really a "behavior change" of MSVC 8.0.
>> Can we do something about it?
>Do you have a suggestion? #pragma warning(disable: 4345)?

Don't forget to push'n'pop the warning level - in case any user finds this warning informative.

#pragma warning(push)
#pragma warning(disable: 4345)

#pragma warning(pop)

Paul A Bristow
Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB
+44 1539561830 & SMS, Mobile +44 7714 330204 & SMS

Boost list run by bdawes at, gregod at, cpdaniel at, john at