Boost logo

Boost :

From: Christopher Currie (christopher_at_[hidden])
Date: 2003-11-06 09:43:01


The following is a patch to workaround a bug Sun C++ with Boost.MPL. It
adds the Sun compiler to the list of toolsets that need the nested type
workaround. A test case is also attached, which demonstrates the error.

Thanks,
Christopher

Index: boost/mpl/aux_/nested_type_wknd.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/mpl/aux_/nested_type_wknd.hpp,v
retrieving revision 1.3
diff -u -r1.3 nested_type_wknd.hpp
--- boost/mpl/aux_/nested_type_wknd.hpp 7 Oct 2002 11:26:41 -0000 1.3
+++ boost/mpl/aux_/nested_type_wknd.hpp 6 Nov 2003 14:36:11 -0000
@@ -21,7 +21,8 @@
 
 #if defined(__GNUC__) && (__GNUC__ < 3 || __GNUC__ == 3 && __GNUC_MINOR__ <= 2 \
     || !defined(BOOST_STRICT_CONFIG)) \
- || defined(__BORLANDC__) && (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG))
+ || defined(__BORLANDC__) && (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG)) \
+ || defined(__SUNPRO_CC)
 
 namespace boost { namespace mpl { namespace aux {
 

#include <iostream>
#include <cassert>
#include <boost/iterator/iterator_facade.hpp>

using namespace boost;

typedef
  detail::const_qualified_ref<int, boost::readable_iterator_tag>::type
  test_type;

template <typename T>
struct printer
{
  std::string type() const
  {
    return "Unknown";
  }
};

template <typename T>
struct printer< T & >
{
  std::string type() const
  {
    return "Reference to plain type";
  }
};

template <typename T>
struct printer< T const & >
{
  std::string type() const
  {
    return "Reference to const type";
  }
};

typedef readable_iterator_tag from_type;
typedef writable_iterator_tag to_type;
  
int main()
{
  std::cerr << printer<test_type>().type() << std::endl;

  assert ( ( mpl::or_< is_convertible<from_type, to_type>, mpl::false_ >::value == false ) );
}


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