Boost C++ Libraries: Ticket #8943: Failed to compile code using boost::call_once with Intel C++ Composer XE 2013 on Windows https://svn.boost.org/trac10/ticket/8943 <p> Environment: </p> <ol><li>Windows 8 Pro x64 Russian. </li><li>MS Visual Studio Ultimate 2012 Update 2. </li><li>Intel C++ Composer XE 2013 (Intel C++ Compiler XE 13.0.0.089 for Windows). </li></ol><p> Tried to compile this code: </p> <div class="wiki-code"><div class="code"><pre><span class="cp">#if defined(WIN32)</span> <span class="cp">#include</span> <span class="cpf">&lt;tchar.h&gt;</span><span class="cp"></span> <span class="cp">#endif</span> <span class="cp">#include</span> <span class="cpf">&lt;cstdlib&gt;</span><span class="cp"></span> <span class="cp">#include</span> <span class="cpf">&lt;iostream&gt;</span><span class="cp"></span> <span class="cp">#include</span> <span class="cpf">&lt;boost/thread/once.hpp&gt;</span><span class="cp"></span> <span class="k">namespace</span> <span class="p">{</span> <span class="k">class</span> <span class="nc">foo</span> <span class="p">{</span> <span class="k">public</span><span class="o">:</span> <span class="kt">void</span> <span class="k">operator</span><span class="p">()()</span> <span class="k">const</span> <span class="p">{</span> <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;foo&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span> <span class="p">}</span> <span class="p">};</span> <span class="c1">// class foo</span> <span class="p">}</span> <span class="cp">#if defined(WIN32)</span> <span class="kt">int</span> <span class="n">_tmain</span><span class="p">(</span><span class="kt">int</span> <span class="cm">/*argc*/</span><span class="p">,</span> <span class="n">_TCHAR</span><span class="o">*</span> <span class="cm">/*argv*/</span><span class="p">[])</span> <span class="cp">#else</span> <span class="kt">int</span> <span class="n">main</span><span class="p">(</span><span class="kt">int</span> <span class="cm">/*argc*/</span><span class="p">,</span> <span class="kt">char</span><span class="o">*</span> <span class="cm">/*argv*/</span><span class="p">[])</span> <span class="cp">#endif</span> <span class="p">{</span> <span class="k">try</span> <span class="p">{</span> <span class="n">boost</span><span class="o">::</span><span class="n">once_flag</span> <span class="n">once_flag</span> <span class="o">=</span> <span class="n">BOOST_ONCE_INIT</span><span class="p">;</span> <span class="n">boost</span><span class="o">::</span><span class="n">call_once</span><span class="p">(</span><span class="n">once_flag</span><span class="p">,</span> <span class="n">foo</span><span class="p">());</span> <span class="k">return</span> <span class="n">EXIT_SUCCESS</span><span class="p">;</span> <span class="p">}</span> <span class="k">catch</span> <span class="p">(...)</span> <span class="p">{</span> <span class="n">std</span><span class="o">::</span><span class="n">cerr</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Unknown exception&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span> <span class="p">}</span> <span class="k">return</span> <span class="n">EXIT_FAILURE</span><span class="p">;</span> <span class="p">}</span> </pre></div></div><p> Got compiler output with this error: </p> <pre class="wiki">&gt;main.cpp(31): error : more than one instance of overloaded function "boost::call_once" matches the argument list: &gt; function template "void boost::call_once(boost::once_flag &amp;, Function)" &gt; function template "void boost::call_once(boost::once_flag &amp;, Function &amp;&amp;)" &gt; argument types are: (boost::once_flag, &lt;unnamed&gt;::foo) &gt; boost::call_once(once_flag, foo()); &gt; ^ </pre><p> There is no such error (tested) with: </p> <ul><li>MS Visual C++ 2012 Update 3 (Visual Studio 2012 Update 3 on Windows 8 Pro x64 Rus), </li><li>Visual C++ 2010 (Visual Studio 2010 on Windows 7 Pro SP1 Rus), </li><li>Visual C++ 2008 (Visual Studio 2008 on Windows XP Pro SP3 Rus). </li></ul> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8943 Trac 1.4.3 avrarov@… Tue, 30 Jul 2013 21:02:10 GMT attachment set https://svn.boost.org/trac10/ticket/8943 https://svn.boost.org/trac10/ticket/8943 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">intel_thread_once.patch</span> </li> </ul> <p> Proposed solution. Tested with all listed above compilers. </p> Ticket viboes Sat, 03 Aug 2013 16:33:49 GMT status, component changed; owner set https://svn.boost.org/trac10/ticket/8943#comment:1 https://svn.boost.org/trac10/ticket/8943#comment:1 <ul> <li><strong>owner</strong> set 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> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">thread</span> </li> </ul> Ticket viboes Sun, 04 Aug 2013 10:08:05 GMT <link>https://svn.boost.org/trac10/ticket/8943#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8943#comment:2</guid> <description> <p> Could you try this patch </p> <p> Replace </p> <pre class="wiki">#ifndef BOOST_MSVC </pre><p> by </p> <pre class="wiki">#if ! defined(BOOST_MSVC) &amp;&amp; ! defined(BOOST_INTEL) </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Thu, 22 Aug 2013 22:15:35 GMT</pubDate> <title>summary changed https://svn.boost.org/trac10/ticket/8943#comment:3 https://svn.boost.org/trac10/ticket/8943#comment:3 <ul> <li><strong>summary</strong> <span class="trac-field-old">Failed to compile code using boost::call_once with Intel C++ Composer XE 2013</span> → <span class="trac-field-new">Failed to compile code using boost::call_once with Intel C++ Composer XE 2013 on Windows</span> </li> </ul> Ticket abrarov@… Fri, 23 Aug 2013 07:52:24 GMT <link>https://svn.boost.org/trac10/ticket/8943#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8943#comment:4</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8943#comment:2" title="Comment 2">viboes</a>: </p> <blockquote class="citation"> <p> Could you try this patch </p> <p> Replace </p> <pre class="wiki">#ifndef BOOST_MSVC </pre><p> by </p> <pre class="wiki">#if ! defined(BOOST_MSVC) &amp;&amp; ! defined(BOOST_INTEL) </pre></blockquote> <p> This was the first solution I've done. But I think that this #if/#endif block isn't necessary at all (may produce errors for other compilers). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 01 Sep 2013 07:23:45 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/8943#comment:5 https://svn.boost.org/trac10/ticket/8943#comment:5 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.55.0</span> </li> </ul> <p> Committed revision <a class="changeset" href="https://svn.boost.org/trac10/changeset/85539" title="Thread: try to handle with call_once intel issue #8943.">[85539]</a>. </p> <p> I would take some more time to refactor the call_once code windows implementation. </p> Ticket viboes Mon, 09 Sep 2013 17:04:16 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/8943#comment:6 https://svn.boost.org/trac10/ticket/8943#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/85622" title="Thread fix #8943.">[85622]</a>) Thread fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8943" title="#8943: Bugs: Failed to compile code using boost::call_once with Intel C++ Composer ... (closed: fixed)">#8943</a>. </p> Ticket