Opened 7 years ago

Last modified 7 years ago

#11550 assigned Bugs

boost::call_once issues — at Version 6

Reported by: lcarreon@… Owned by: viboes
Milestone: To Be Determined Component: thread
Version: Boost 1.59.0 Severity: Problem
Keywords: Cc:

Description (last modified by viboes)

I compiled Boost 1.59.0 with Solaris Studio 12.4 in C++11 mode and I

get the following error messages:

"libs/thread/src/pthread/thread.cpp", line 144: Error: Overloading ambiguity between "boost::call_once<void(*)()>(boost::once_flag&, void(*)())" and "boost::call_once<void(&)()>(boost::once_flag&, void(&)())".
"libs/thread/src/pthread/thread.cpp", line 150: Error: Overloading ambiguity between "boost::call_once<void(*)()>(boost::once_flag&, void(*)())" and "boost::call_once<void(&)()>(boost::once_flag&, void(&)())".
"libs/context/src/posix/stack_traits.cpp", line 58: Error: Overloading ambiguity between "boost::call_once<void(&)(unsigned long*), unsigned long*>(boost::once_flag&, void(&)(unsigned long*), unsigned long*&&)" and "boost::call_once<void(*)(unsigned long*), unsigned long*>(boost::once_flag&, void(*)(unsigned long*), unsigned long*)".
"libs/context/src/posix/stack_traits.cpp", line 66: Error: Overloading ambiguity between "boost::call_once<void(&)(rlimit*), rlimit*>(boost::once_flag&, void(&)(rlimit*), rlimit*&&)" and "boost::call_once<void(*)(rlimit*), rlimit*>(boost::once_flag&, void(*)(rlimit*), rlimit*)".
"libs/coroutine/src/posix/stack_traits.cpp", line 56: Error: Overloading ambiguity between "boost::call_once<void(&)(unsigned long*), unsigned long*>(boost::once_flag&, void(&)(unsigned long*), unsigned long*&&)" and "boost::call_once<void(*)(unsigned long*), unsigned long*>(boost::once_flag&, void(*)(unsigned long*), unsigned long*)".
"libs/coroutine/src/posix/stack_traits.cpp", line 64: Error: Overloading ambiguity between "boost::call_once<void(&)(rlimit*), rlimit*>(boost::once_flag&, void(&)(rlimit*), rlimit*&&)" and "boost::call_once<void(*)(rlimit*), rlimit*>(boost::once_flag&, void(*)(rlimit*), rlimit*)".
"./boost/thread/once.hpp", line 38: Error: Overloading ambiguity between "boost::call_once<void(*)()>(boost::once_flag&, void(*)())" and "boost::call_once<void(*)()&>(boost::once_flag&, void(*)()&)".
"./boost/spirit/home/classic/core/non_terminal/impl/object_with_id.ipp", line 145: Error: Overloading ambiguity between "boost::call_once<void(*)()>(boost::once_flag&, void(*)())" and "boost::call_once<void(&)()>(boost::once_flag&, void(&)())".
"./boost/spirit/home/classic/phoenix/closures.hpp", line 427: Error: Overloading ambiguity between "boost::call_once<void(*)()>(boost::once_flag&, void(*)())" and "boost::call_once<void(&)()>(boost::once_flag&, void(&)())".
"./boost/thread/once.hpp", line 38: Error: Overloading ambiguity between "boost::call_once<void(*)()>(boost::once_flag&, void(*)())" and "boost::call_once<void(*)()&>(boost::once_flag&, void(*)()&)".
"./boost/spirit/home/classic/core/non_terminal/impl/object_with_id.ipp", line 145: Error: Overloading ambiguity between "boost::call_once<void(*)()>(boost::once_flag&, void(*)())" and "boost::call_once<void(&)()>(boost::once_flag&, void(&)())".
"./boost/thread/once.hpp", line 38: Error: Overloading ambiguity between "boost::call_once<void(*)()>(boost::once_flag&, void(*)())" and "boost::call_once<void(*)()&>(boost::once_flag&, void(*)()&)".
"./boost/spirit/home/classic/core/non_terminal/impl/object_with_id.ipp", line 145: Error: Overloading ambiguity between "boost::call_once<void(*)()>(boost::once_flag&, void(*)())" and "boost::call_once<void(&)()>(boost::once_flag&, void(&)())".
"./boost/spirit/home/classic/phoenix/closures.hpp", line 427: Error: Overloading ambiguity between "boost::call_once<void(*)()>(boost::once_flag&, void(*)())" and "boost::call_once<void(&)()>(boost::once_flag&, void(&)())".
"./boost/thread/once.hpp", line 38: Error: Overloading ambiguity between "boost::call_once<void(*)()>(boost::once_flag&, void(*)())" and "boost::call_once<void(*)()&>(boost::once_flag&, void(*)()&)".
"./boost/spirit/home/classic/core/non_terminal/impl/object_with_id.ipp", line 145: Error: Overloading ambiguity between "boost::call_once<void(*)()>(boost::once_flag&, void(*)())" and "boost::call_once<void(&)()>(boost::once_flag&, void(&)())".
"./boost/thread/once.hpp", line 38: Error: Overloading ambiguity between "boost::call_once<void(*)()>(boost::once_flag&, void(*)())" and "boost::call_once<void(*)()&>(boost::once_flag&, void(*)()&)".
"./boost/spirit/home/classic/core/non_terminal/impl/object_with_id.ipp", line 145: Error: Overloading ambiguity between "boost::call_once<void(*)()>(boost::once_flag&, void(*)())" and "boost::call_once<void(&)()>(boost::once_flag&, void(&)())".

I'm not 100% sure whether these are compiler issues or Boost compiler configuration issues thus I decided to raise this ticket.

Change History (6)

comment:1 by John Maddock, 7 years ago

Component: Building Boostthread
Owner: set to Anthony Williams

comment:2 by John Maddock, 7 years ago

I believe this has been fixed now in https://github.com/boostorg/thread/pull/60

comment:3 by lcarreon@…, 7 years ago

FYI, I tried implementing the code change mentioned above. It is now complaining about this:

"./boost/thread/pthread/once_atomic.hpp", line 168: Error: Overloading ambiguity between "boost::detail::invoke<void, void(*)(rlimit*), rlimit*>(void(*)(rlimit*)&, rlimit*)" and "boost::detail::invoke<void, void(*)(rlimit*), rlimit*&>(void(*)(rlimit*)&, rlimit*&)".

Looking at the line being complained above, I realized it is in the part of the code where there is no support for variadic templates and rvalue references. IMO, this is incorrect because according to the Solaris Studio 12.4 documentation, it does support these two C++11 features in C++11 mode. Only thread related features are missing. I'm not sure if there is a way to distinguish if the compiler is in C++11 mode or not.

Taking the above into consideration, I undid your changes described above and changed the boost/config/compiler/sunpro_cc.hpp file instead to move BOOST_NO_CXX11_VARIADIC_TEMPLATES to affect Solaris Studio 12.3 and below only. This new change has eliminated all the boost::call_once related errors but it did generate signal 11 errors in various libraries as mentioned in a comment in the compiler configuration file. It also generated template argument errors in Boost.Log and Boost.Variant (1 line each).

comment:4 by John Maddock, 7 years ago

We've cross posted:

However, the errors from invoke do not occur when building the thread lib, only when building the context lib which I believe has other errors as well, and won't be easy to fix.

BTW, I don't think that enabling a feature (variadic templates) which is known to cause problems is the right solution either.

comment:5 by viboes, 7 years ago

Owner: changed from Anthony Williams to viboes
Status: newassigned

comment:6 by viboes, 7 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.