
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Niels Dekker - mail address until 2008-12-31 Sent: 15 October 2007 13:00 To: boost@lists.boost.org 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 initialized. 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. #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4345) #endif ... #ifdef BOOST_MSVC #pragma warning(pop) #endif --- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow@hetp.u-net.com