diff --git a/include/boost/foreach.hpp b/include/boost/foreach.hpp index fee9645..a11c153 100755 --- a/include/boost/foreach.hpp +++ b/include/boost/foreach.hpp @@ -14,6 +14,7 @@ // Russell Hind - For help porting to Borland // Alisdair Meredith - For help porting to Borland // Stefan Slapeta - For help porting to Intel +// David Jenkins - For help finding a Microsoft Code Analysis bug #ifndef BOOST_FOREACH @@ -29,7 +30,7 @@ #include // Some compilers let us detect even const-qualified rvalues at compile-time -#if BOOST_WORKAROUND(BOOST_MSVC, >= 1310) \ +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1310) && !defined(_PREFAST_) \ || (BOOST_WORKAROUND(__GNUC__, >= 4) && !defined(BOOST_INTEL)) \ || (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ >= 4) && !defined(BOOST_INTEL)) # define BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION diff --git a/test/rvalue_const.cpp b/test/rvalue_const.cpp index 6d11876..eaa0628 100755 --- a/test/rvalue_const.cpp +++ b/test/rvalue_const.cpp @@ -13,7 +13,10 @@ #include #ifdef BOOST_FOREACH_NO_CONST_RVALUE_DETECTION +// ignore error during Microsoft Code Analysis +#if !defined(_PREFAST_) # error Expected failure : const rvalues disallowed +#endif #else std::vector const get_vector()