Boost C++ Libraries: Ticket #1773: VC8 compiler bug makes boost spill types into global namespace, which breaks IntelTBB https://svn.boost.org/trac10/ticket/1773 <p> Hi all, </p> <p> This is with VC8 SP1. </p> <p> We tried to compile our app with boost 1.35.0 and got errors in Intel TBB that int32_t was already defined. </p> <p> After some debugging, we have boiled it down to the following repro case, which shouldn't compile. It compiles on VC8 but not on VC9. </p> <p> Just run cl on the following: </p> <div class="wiki-code"><div class="code"><pre><span class="k">namespace</span> <span class="n">bzt</span> <span class="p">{</span> <span class="k">typedef</span> <span class="kt">long</span> <span class="n">fiddle</span><span class="p">;</span> <span class="p">}</span> <span class="k">namespace</span> <span class="n">foo</span> <span class="p">{</span> <span class="k">using</span> <span class="k">namespace</span> <span class="n">bzt</span><span class="p">;</span> <span class="c1">// removing using makes it work too</span> <span class="k">class</span> <span class="nc">baz</span> <span class="p">{</span> <span class="k">public</span><span class="o">:</span> <span class="k">virtual</span> <span class="kt">void</span> <span class="n">meep</span><span class="p">()</span> <span class="c1">// removeingvirtual makes it fail</span> <span class="p">{</span> <span class="p">}</span> <span class="p">};</span> <span class="k">namespace</span> <span class="n">foobar</span> <span class="p">{</span> <span class="kt">void</span> <span class="n">geronimo</span><span class="p">()</span> <span class="p">{</span> <span class="k">throw</span> <span class="n">baz</span><span class="p">();</span> <span class="p">}</span> <span class="p">}</span> <span class="c1">// namespace foobar</span> <span class="p">}</span> <span class="c1">// namespace foo</span> <span class="n">fiddle</span> <span class="n">dummy</span><span class="p">;</span> <span class="c1">// should not compile, but does</span> </pre></div></div><p> For boost, the actual names used are </p> <p> namespace bzt = boost fiddle = int32_t foo = boost_132 baz = bad_weak_ptr meep = bad_weak_ptr::what foobar = detail geronimo = bad_weak_ref throw baz() = boost::throw_exception(bad_weak_ptr) </p> <p> and can be reproduced using boost code with simply: </p> <pre class="wiki">!#cpp #include &lt;boost/cstdint.hpp&gt; #include &lt;boost/detail/workaround.hpp&gt; #include &lt;boost/serialization/detail/shared_count_132.hpp&gt; int32_t dummy; // Should not compile, but does. </pre><p> The function throwing is boost_132::detail::sp_counted_base::add_ref_lock() which does boost::throw: </p> <pre class="wiki">!#cpp void add_ref_lock() { if(use_count_ == 0) boost::throw_exception(bad_weak_ptr()); ++use_count_; } </pre><p> Where bad_weak_ptr have a virtual function. </p> <p> I suppose a fix/workaround would be to not use the boost_132 namespace which imports boost. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1773 Trac 1.4.3 macke@… Fri, 04 Apr 2008 13:49:05 GMT <link>https://svn.boost.org/trac10/ticket/1773#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1773#comment:1</guid> <description> <p> The mapping between my example and boost names got messed up: </p> <pre class="wiki">namespace bzt = boost fiddle = int32_t foo = boost_132 baz = bad_weak_ptr meep = bad_weak_ptr::what foobar = detail geronimo = bad_weak_ref throw baz() = boost::throw_exception(bad_weak_ptr) </pre> </description> <category>Ticket</category> </item> <item> <author>macke@…</author> <pubDate>Sat, 05 Apr 2008 12:54:00 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1773#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1773#comment:2</guid> <description> <p> Just for reference, this has been confirmed by Microsoft: </p> <p> <a class="ext-link" href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=336708"><span class="icon">​</span>http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=336708</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Mon, 07 Apr 2008 16:27:05 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/1773#comment:3 https://svn.boost.org/trac10/ticket/1773#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> Good analysis - will fix. </p> <p> Robert Ramey </p> Ticket Robert Ramey Fri, 11 Apr 2008 05:11:12 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/1773#comment:4 https://svn.boost.org/trac10/ticket/1773#comment:4 <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> fixed - will check in later </p> Ticket