Boost C++ Libraries: Ticket #11550: Solaris - boost::call_once issues https://svn.boost.org/trac10/ticket/11550 <p> I compiled Boost 1.59.0 with Solaris Studio 12.4 in C++11 mode and I </p> <blockquote> <p> get the following error messages: </p> </blockquote> <pre class="wiki">"libs/thread/src/pthread/thread.cpp", line 144: Error: Overloading ambiguity between "boost::call_once&lt;void(*)()&gt;(boost::once_flag&amp;, void(*)())" and "boost::call_once&lt;void(&amp;)()&gt;(boost::once_flag&amp;, void(&amp;)())". "libs/thread/src/pthread/thread.cpp", line 150: Error: Overloading ambiguity between "boost::call_once&lt;void(*)()&gt;(boost::once_flag&amp;, void(*)())" and "boost::call_once&lt;void(&amp;)()&gt;(boost::once_flag&amp;, void(&amp;)())". "libs/context/src/posix/stack_traits.cpp", line 58: Error: Overloading ambiguity between "boost::call_once&lt;void(&amp;)(unsigned long*), unsigned long*&gt;(boost::once_flag&amp;, void(&amp;)(unsigned long*), unsigned long*&amp;&amp;)" and "boost::call_once&lt;void(*)(unsigned long*), unsigned long*&gt;(boost::once_flag&amp;, void(*)(unsigned long*), unsigned long*)". "libs/context/src/posix/stack_traits.cpp", line 66: Error: Overloading ambiguity between "boost::call_once&lt;void(&amp;)(rlimit*), rlimit*&gt;(boost::once_flag&amp;, void(&amp;)(rlimit*), rlimit*&amp;&amp;)" and "boost::call_once&lt;void(*)(rlimit*), rlimit*&gt;(boost::once_flag&amp;, void(*)(rlimit*), rlimit*)". "libs/coroutine/src/posix/stack_traits.cpp", line 56: Error: Overloading ambiguity between "boost::call_once&lt;void(&amp;)(unsigned long*), unsigned long*&gt;(boost::once_flag&amp;, void(&amp;)(unsigned long*), unsigned long*&amp;&amp;)" and "boost::call_once&lt;void(*)(unsigned long*), unsigned long*&gt;(boost::once_flag&amp;, void(*)(unsigned long*), unsigned long*)". "libs/coroutine/src/posix/stack_traits.cpp", line 64: Error: Overloading ambiguity between "boost::call_once&lt;void(&amp;)(rlimit*), rlimit*&gt;(boost::once_flag&amp;, void(&amp;)(rlimit*), rlimit*&amp;&amp;)" and "boost::call_once&lt;void(*)(rlimit*), rlimit*&gt;(boost::once_flag&amp;, void(*)(rlimit*), rlimit*)". "./boost/thread/once.hpp", line 38: Error: Overloading ambiguity between "boost::call_once&lt;void(*)()&gt;(boost::once_flag&amp;, void(*)())" and "boost::call_once&lt;void(*)()&amp;&gt;(boost::once_flag&amp;, void(*)()&amp;)". "./boost/spirit/home/classic/core/non_terminal/impl/object_with_id.ipp", line 145: Error: Overloading ambiguity between "boost::call_once&lt;void(*)()&gt;(boost::once_flag&amp;, void(*)())" and "boost::call_once&lt;void(&amp;)()&gt;(boost::once_flag&amp;, void(&amp;)())". "./boost/spirit/home/classic/phoenix/closures.hpp", line 427: Error: Overloading ambiguity between "boost::call_once&lt;void(*)()&gt;(boost::once_flag&amp;, void(*)())" and "boost::call_once&lt;void(&amp;)()&gt;(boost::once_flag&amp;, void(&amp;)())". "./boost/thread/once.hpp", line 38: Error: Overloading ambiguity between "boost::call_once&lt;void(*)()&gt;(boost::once_flag&amp;, void(*)())" and "boost::call_once&lt;void(*)()&amp;&gt;(boost::once_flag&amp;, void(*)()&amp;)". "./boost/spirit/home/classic/core/non_terminal/impl/object_with_id.ipp", line 145: Error: Overloading ambiguity between "boost::call_once&lt;void(*)()&gt;(boost::once_flag&amp;, void(*)())" and "boost::call_once&lt;void(&amp;)()&gt;(boost::once_flag&amp;, void(&amp;)())". "./boost/thread/once.hpp", line 38: Error: Overloading ambiguity between "boost::call_once&lt;void(*)()&gt;(boost::once_flag&amp;, void(*)())" and "boost::call_once&lt;void(*)()&amp;&gt;(boost::once_flag&amp;, void(*)()&amp;)". "./boost/spirit/home/classic/core/non_terminal/impl/object_with_id.ipp", line 145: Error: Overloading ambiguity between "boost::call_once&lt;void(*)()&gt;(boost::once_flag&amp;, void(*)())" and "boost::call_once&lt;void(&amp;)()&gt;(boost::once_flag&amp;, void(&amp;)())". "./boost/spirit/home/classic/phoenix/closures.hpp", line 427: Error: Overloading ambiguity between "boost::call_once&lt;void(*)()&gt;(boost::once_flag&amp;, void(*)())" and "boost::call_once&lt;void(&amp;)()&gt;(boost::once_flag&amp;, void(&amp;)())". "./boost/thread/once.hpp", line 38: Error: Overloading ambiguity between "boost::call_once&lt;void(*)()&gt;(boost::once_flag&amp;, void(*)())" and "boost::call_once&lt;void(*)()&amp;&gt;(boost::once_flag&amp;, void(*)()&amp;)". "./boost/spirit/home/classic/core/non_terminal/impl/object_with_id.ipp", line 145: Error: Overloading ambiguity between "boost::call_once&lt;void(*)()&gt;(boost::once_flag&amp;, void(*)())" and "boost::call_once&lt;void(&amp;)()&gt;(boost::once_flag&amp;, void(&amp;)())". "./boost/thread/once.hpp", line 38: Error: Overloading ambiguity between "boost::call_once&lt;void(*)()&gt;(boost::once_flag&amp;, void(*)())" and "boost::call_once&lt;void(*)()&amp;&gt;(boost::once_flag&amp;, void(*)()&amp;)". "./boost/spirit/home/classic/core/non_terminal/impl/object_with_id.ipp", line 145: Error: Overloading ambiguity between "boost::call_once&lt;void(*)()&gt;(boost::once_flag&amp;, void(*)())" and "boost::call_once&lt;void(&amp;)()&gt;(boost::once_flag&amp;, void(&amp;)())". </pre><p> I'm not 100% sure whether these are compiler issues or Boost compiler configuration issues thus I decided to raise this ticket. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11550 Trac 1.4.3 John Maddock Tue, 18 Aug 2015 16:09:09 GMT component changed; owner set https://svn.boost.org/trac10/ticket/11550#comment:1 https://svn.boost.org/trac10/ticket/11550#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Anthony Williams</span> </li> <li><strong>component</strong> <span class="trac-field-old">Building Boost</span> → <span class="trac-field-new">thread</span> </li> </ul> Ticket John Maddock Thu, 20 Aug 2015 08:06:38 GMT <link>https://svn.boost.org/trac10/ticket/11550#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11550#comment:2</guid> <description> <p> I believe this has been fixed now in <a class="ext-link" href="https://github.com/boostorg/thread/pull/60"><span class="icon">​</span>https://github.com/boostorg/thread/pull/60</a> </p> </description> <category>Ticket</category> </item> <item> <author>lcarreon@…</author> <pubDate>Thu, 20 Aug 2015 11:16:55 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11550#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11550#comment:3</guid> <description> <p> FYI, I tried implementing the code change mentioned above. It is now complaining about this: </p> <p> "./boost/thread/pthread/once_atomic.hpp", line 168: Error: Overloading ambiguity between "boost::detail::invoke&lt;void, void(*)(rlimit*), rlimit*&gt;(void(*)(rlimit*)&amp;, rlimit*)" and "boost::detail::invoke&lt;void, void(*)(rlimit*), rlimit*&amp;&gt;(void(*)(rlimit*)&amp;, rlimit*&amp;)". </p> <p> 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. </p> <p> 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). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Thu, 20 Aug 2015 12:15:54 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11550#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11550#comment:4</guid> <description> <p> We've cross posted: </p> <ul><li>I made a mistake in the original PR, fixed in <a class="ext-link" href="https://github.com/boostorg/thread/pull/61"><span class="icon">​</span>https://github.com/boostorg/thread/pull/61</a> </li><li>I also commented in the above PR about the errors from invoke. </li></ul><p> 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. </p> <p> BTW, I don't think that enabling a feature (variadic templates) which is known to cause problems is the right solution either. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Thu, 20 Aug 2015 22:52:19 GMT</pubDate> <title>owner, status changed https://svn.boost.org/trac10/ticket/11550#comment:5 https://svn.boost.org/trac10/ticket/11550#comment:5 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket viboes Thu, 03 Sep 2015 06:28:50 GMT description changed https://svn.boost.org/trac10/ticket/11550#comment:6 https://svn.boost.org/trac10/ticket/11550#comment:6 <ul> <li><strong>description</strong> modified (<a href="/trac10/ticket/11550?action=diff&amp;version=6">diff</a>) </li> </ul> Ticket viboes Thu, 03 Sep 2015 06:51:11 GMT owner, status changed https://svn.boost.org/trac10/ticket/11550#comment:7 https://svn.boost.org/trac10/ticket/11550#comment:7 <ul> <li><strong>owner</strong> changed from <span class="trac-author">viboes</span> to <span class="trac-author">Andrey Semashev</span> </li> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">new</span> </li> </ul> <p> There is a SUN specific code in </p> <pre class="wiki">#if !(defined(__SUNPRO_CC) &amp;&amp; BOOST_WORKAROUND(__SUNPRO_CC, &lt;= 0x5130)) template&lt;typename Function&gt; inline void call_once(once_flag&amp; flag, BOOST_THREAD_RV_REF(Function) f) </pre><p> Would this condition be satisfied with your compiler version? Could you show the report of the lines of the overloads that are ambiguous? </p> <p> Assigning to Andrey in case he has a better understanding as he wrote once_atomic. </p> Ticket Andrey Semashev Thu, 03 Sep 2015 10:32:04 GMT <link>https://svn.boost.org/trac10/ticket/11550#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11550#comment:8</guid> <description> <p> Umm, I can see there are lots of changes that I didn't do (the <code>INVOKE</code> part at least), so maybe I'm not the one with the better understanding currently. :) </p> <p> To me this looks like a compiler bug that should be reported to Oracle. As a quick fix for invoke problem I can suggest <code>#if</code>-ing out the whole invoke.hpp contents for this compiler, so that <code>BOOST_THREAD_PROVIDES_INVOKE</code> is not defined and <code>boost::bind</code> is used instead. A more efficient fix might be to tweak the <code>invoke</code> overloads somehow but to do that it would require a lot more experimenting, which is difficult as I don't have the compiler. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Tue, 08 Sep 2015 19:47:55 GMT</pubDate> <title>owner, status changed https://svn.boost.org/trac10/ticket/11550#comment:9 https://svn.boost.org/trac10/ticket/11550#comment:9 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Andrey Semashev</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> Oh, I see now that the call_once ambiguity has been avoided already. </p> Ticket viboes Wed, 23 Sep 2015 22:23:06 GMT summary changed https://svn.boost.org/trac10/ticket/11550#comment:10 https://svn.boost.org/trac10/ticket/11550#comment:10 <ul> <li><strong>summary</strong> <span class="trac-field-old">boost::call_once issues</span> → <span class="trac-field-new">Solaris - boost::call_once issues</span> </li> </ul> Ticket