Boost logo

Boost Users :

Subject: [Boost-users] Fix for intrusive on Sun CC
From: Chris Hite (C.Hite_at_[hidden])
Date: 2009-08-10 11:36:03


I'm not sure if it fixes everything, but I was able debug some of the
meta-programming and find a discrepancy between gcc and Sun CC which
causes normal usage to break.

http://www.boost.org/doc/libs/1_39_0/boost/intrusive/detail/utilities.hpp

template <class T>
struct internal_base_hook_bool
{
   template<bool Add>
   struct two_or_three {one _[2 + Add];};
   template <class U> static one test(...);
   template <class U> static
two_or_three<U::boost_intrusive_tags::is_base_hook>
      test (detail::bool_<U::boost_intrusive_tags::is_base_hook>* = 0);
   static const std::size_t value = sizeof(test<T>(0));
};

On gcc it does what it's suppose to; value =
    1 - iff T has no boost_intrusive_tags::is_base_hook
    2 - iff T::boost_intrusive_tags::is_base_hook=false
    3 - iff T::boost_intrusive_tags::is_base_hook=true
On Sun CC it's always 1. So this is a usage of SFINAE which doesn't seem to work on SunCC, but other examples do work just fine:

class_has_move_assign here:
http://www.boost.org/doc/libs/1_38_0/boost/unordered/detail/move.hpp
Note how they use a second test(int) function. This works on Sun CC!

1) I've never submitted a change. Will someone else take this over or
do I need to dive in and submit changes to the repository? Do I need to
talk this library's owner first?

2) Is this a definite CC compiler bug?


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