Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-07-14 01:57:29


Hello,
I suggest that the following patch be applied to type_traits/detail/cv_traits_impl.hpp:

--- cv_traits_impl.hpp 22 Jun 2005 16:59:26 -0000 1.4
+++ cv_traits_impl.hpp 14 Jul 2005 06:49:40 -0000
@@ -19,7 +19,7 @@
 // implementation helper:
 
 
-#if !(BOOST_WORKAROUND(__GNUC__,== 3) && (__GNUC_MINOR__ <= 2))
+#if !(BOOST_WORKAROUND(__GNUC__,== 3) && BOOST_WORKAROUND(__GNUC_MINOR__, <= 2))
 namespace boost {
 namespace detail {
 #else

The reason is that later in the file, we have:

#if BOOST_WORKAROUND(__GNUC__,== 3) && BOOST_WORKAROUND(__GNUC_MINOR__, <= 2)

and first condition does not exactly match the second condition.

Specifically, suppose __GNUC__ is set to 3 and __GNUC_MINOR__ is not set. The first condition will evaluate to

    ! (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ <= 2) =
    ! (1 && (0 <= 2)) =
    ! (1 && 1 ) =
    0

The second condition in the file will evaluate to:

    BOOST_WORKAROUND(__GNUC__,== 3) && BOOST_WORKAROUND(__GNUC_MINOR__, <= 2) =
    1 && 0 =
    0

So, both conditions evaluate to the same value, while they are supposed to be mutually exclusive.

The case where __GNUC_MINOR__ is not set is a pathological -- I've found it when playing with some C++ parser,
but the patch should do no harm.

Opinions?

- Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk