Modify

Ticket #7033 (closed Patches: fixed)

Opened 22 months ago

Last modified 22 months ago

SolarisStudio 12.3 bug: doesn't like intrusive::detail::type_has_rebind::test() declarations

Reported by: anonymous Owned by: igaztanaga
Milestone: To Be Determined Component: intrusive
Version: Boost 1.49.0 Severity: Problem
Keywords: Cc:

Description

With (unpatched) SolarisStudio? 12.3

CC -V
CC: Sun C++ 5.12 SunOS_i386 2011/11/16

This:

#include <boost/container/deque.hpp>

int main()
{
    boost::container::deque<int> myDeque;
    return 0;
}

Fails to build:

CC test.cpp -g -I/path/to/boost -library=stlport4
ir_build_type(): unexpected type

Without -g gives the marginally more useful:

CC test.cpp -I/path/to/boost -I/opt/csw/include -library=stlport4
"include/boost/container/deque.hpp", line 487: Error: Cannot use int to initialize boost::container::allocator_traits<std::allocator<std::allocator<void>::_Tp1>>::pointer.
"include/boost/container/deque.hpp", line 387:     Where: While instantiating "boost::container::deque_base<int, std::allocator<int>>::members_holder::members_holder()".
"include/boost/container/deque.hpp", line 387:     Where: Instantiated from boost::container::deque_base<int, std::allocator<int>>::deque_base().
"include/boost/container/deque.hpp", line 837:     Where: Instantiated from boost::container::deque<int, std::allocator<int>>::deque().
"test.cpp", line 5:     Where: Instantiated from non-template code.
1 Error(s) detected.

Took some time to track down, but it appears the compiler is unhappy with the test() declarations in type_has_rebind and type_has_rebind_other from intrusive/detail/memory_util.hpp. Removing the template keyword (e.g. static char test(int, typename X::rebind<T>*); ) allows successful compilation, but with a warning about the missing template, which is somewhat amusing!

CC test.cpp -g -I/path/to/boost -library=stlport4
"include/boost/intrusive/detail/memory_util.hpp", line 188: Warning (Anachronism): Using rebind as a template without a declaration.
"include/boost/intrusive/detail/memory_util.hpp", line 216:     Where: While specializing "boost::intrusive::detail::type_has_rebind<std::allocator<int>, int*>".
"include/boost/intrusive/detail/memory_util.hpp", line 216:     Where: Specialized in boost::intrusive::detail::type_rebind_mode<std::allocator<int>, int*>.
"include/boost/intrusive/detail/memory_util.hpp", line 224:     Where: Specialized in boost::container::allocator_traits<std::allocator<int>>::portable_rebind_alloc<int*>.
"include/boost/container/deque.hpp", line 113:     Where: Specialized in boost::container::deque_base<int, std::allocator<int>>.
"include/boost/container/deque.hpp", line 533:     Where: Specialized in boost::container::deque<int, std::allocator<int>>.
"test.cpp", line 5:     Where: Specialized in non-template code.
"include/boost/intrusive/detail/memory_util.hpp", line 204: Warning (Anachronism): Using rebind as a template without a declaration.
"include/boost/intrusive/detail/memory_util.hpp", line 217:     Where: While specializing "boost::intrusive::detail::type_has_rebind_other<std::allocator<int>, int*>".
"include/boost/intrusive/detail/memory_util.hpp", line 217:     Where: Specialized in boost::intrusive::detail::type_rebind_mode<std::allocator<int>, int*>.
"include/boost/intrusive/detail/memory_util.hpp", line 224:     Where: Specialized in boost::container::allocator_traits<std::allocator<int>>::portable_rebind_alloc<int*>.
"include/boost/container/deque.hpp", line 113:     Where: Specialized in boost::container::deque_base<int, std::allocator<int>>.
"include/boost/container/deque.hpp", line 533:     Where: Specialized in boost::container::deque<int, std::allocator<int>>.
"test.cpp", line 5:     Where: Specialized in non-template code.
"include/boost/container/allocator/allocator_traits.hpp", line 234: Warning: The variable flag has not yet been assigned a value.
3 Warning(s) detected.

I've attached the patch I'm using (against 1.49.0) in case it's of any interest. I also noticed that test() declarations are in type_rebind_mode but appear to be unused - the patch also removes those.

Sadly I don't have an Oracle support contract so probably can't do much about reporting the compiler problem at the moment.

Regards

Luke Elliott.

Attachments

memory_util.patch Download (1.7 KB) - added by lukester_null@… 22 months ago.

Change History

Changed 22 months ago by lukester_null@…

comment:1 Changed 22 months ago by igaztanaga

  • Status changed from new to closed
  • Resolution set to fixed

Thanks for the report. I don't have access to Sun compiler and I'm afraid is not standard conforming enough in many cases. Anyway, I applied your patch in trunk at revision: 79437

comment:2 Changed 22 months ago by lukester_null@…

Yes it certainly can be a struggle! Anyway, thanks. When there's a new version of the compiler available I'll try to remember to try this without the patch and report if there's any change...

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.