Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#7033 closed Patches (fixed)

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

Reported by: anonymous Owned by: Ion Gaztañaga
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 (1)

memory_util.patch (1.7 KB) - added by lukester_null@… 5 years ago.

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by lukester_null@…

Attachment: memory_util.patch added

comment:1 Changed 5 years ago by Ion Gaztañaga

Resolution: fixed
Status: newclosed

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 5 years 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...

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ion Gaztañaga.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.