Opened 13 years ago

Closed 13 years ago

#3339 closed Bugs (fixed)

intrusive containers vs. Sun CC

Reported by: Christopher Hite <c.hite@…> Owned by: Ion Gaztañaga
Milestone: Boost 1.40.0 Component: intrusive
Version: Boost 1.39.0 Severity: Problem
Keywords: Cc:

Description

Intrusive doesn't not work at all with SunCC. The regression tests were turned off.

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[[BR]]  Note how they use a second test(int) function. This works fine on Sun CC!

So I would suggest changing this in the few places in intrusive where SFINAE is used. Perhaps intrusive will then work on the latest Sun CC (which supposedly supports (mostly) MPL). Do you have a Sun environment to run the regression tests?

Change History (7)

comment:1 by Steven Watanabe, 13 years ago

Can you

  1. Make a patch
  2. Run the regression tests.

To run the regression tests manually use

cd libs/intrisuve/test
bjam toolset=sun

comment:2 by Christopher Hite <c.hite@…>, 13 years ago

I did the fix I suggested and libs/intrisuve/test looks a little better ...failed updating 19 targets... went to: ...failed updating 16 targets...

https://svn.boost.org/svn/boost/sandbox-branches/intrusive_fix_SunCC revision 55765

The reason all the other tests fail is that they test the class twice once with normal pointers and once with a test smart_pointer class which resembles interprocess::pointer. Issues with this test class seem to still break on Sun CC. I don't really care in my application. It would be nice if I could show the tests for the individual classes worked.

Could we merge my very small changes into the trunk?

Do I need to continue and fix the smart pointer test? Does anyone care?

comment:3 by anonymous, 13 years ago

Can you show us the patch?

comment:4 by Christopher Hite <c.hite@…>, 13 years ago

r55765 - sorry hadn't read Trac Links page.

comment:5 by Ion Gaztañaga, 13 years ago

The patch:

https://svn.boost.org/trac/boost/changeset?old_path=%2F&old=55764&new_path=%2F&new=55765

seems ok. Please commit, but it would nice if you could also fix other test cases.

comment:6 by Christopher Hite <c.hite@…>, 13 years ago

Sorry, I don't think I have privileges to touch the trunk. I only asked for a sandbox account.

r55775 - I was able to fix the test code! After removing explicit from smart_ptr's constructor everything works fine. All tests pass on my version of Sun CC.
CC: Sun C++ 5.9 SunOS_i386 Patch 124864-12 2009/04/21

I kind of think Sun CC is right to complain about this:

".../boost/intrusive/sgtree.hpp", line 390: Error: Formal argument header of type 
boost::intrusive::smart_ptr<boost::intrusive::tree_node<boost::intrusive::smart_ptr<void>>> 
	in call to static 
boost::intrusive::sgtree_algorithms<boost::intrusive::tree_node_traits<boost::intrusive::smart_ptr<void>>>::init_header(
boost::intrusive::smart_ptr<boost::intrusive::tree_node<boost::intrusive::smart_ptr<void>>>) 
	is being passed 
boost::intrusive::tree_node<boost::intrusive::smart_ptr<void>>*

You are converting node* to node_ptr implicitly in that call. I can't figure out why gcc allows this. You'd think it'd be the second "template <class T> smart_ptr(T *ptr)", but commenting that doesn't keep gcc from compiling.

1) So please review this other tiny one line change and let me know it's all good.

2) Please do the merging or let me know if I can.

3) Someone needs to turn these tests back on for Sun 5.9. You may need to upgrade it from 2007/05/03 to something this year.
http://www.boost.org/development/tests/trunk/Sandia-sun.html

comment:7 by Christopher Hite <c.hite@…>, 13 years ago

Resolution: fixed
Status: newclosed

1-2: You can forget about. I merged the changes to trunk (r55784).

3: I'll ask the list about.

Note: See TracTickets for help on using tickets.