Boost C++ Libraries: Ticket #10975: The name exception is ambiguous, exception and std::exception. https://svn.boost.org/trac10/ticket/10975 <ol><li>Description of the failure. </li></ol><p> On Solaris 11.2 Oracle Studio 12.4 C++ compiler under -std=c++11 option produces the following error messages for libs/spirit/classic/test/match_tests.cpp test. </p> <p> "/usr/include/math.h", line 215: Error: The name exception is ambiguous, exception and std::exception. "/usr/include/math.h", line 215: Error: The name exception is ambiguous, exception and std::exception. ".../boost/exception/exception.hpp", line 140: Error: The name exception is ambiguous, exception and std::exception. </p> <p> and actually it produces similar error messages for small test like this: </p> <blockquote> <p> namespace boost { </p> <blockquote> <p> class exception; </p> </blockquote> <p> } using namespace boost; #include &lt;algorithm&gt; </p> </blockquote> <p> or like this: </p> <blockquote> <p> class exception; using namespace std; #include &lt;algorithm&gt; </p> </blockquote> <p> Note that in the original boost harness "class exception;" can be found inside: boost/exception/exception.hpp </p> <ol start="2"><li>Cause of the failure. </li></ol><p> This is a C++ vs Unix or Boost vs Unix issue. </p> <p> Standard Unix requires "struct exception" in the global namespace when &lt;math.h&gt; is included. This conflicts with std::exception or boost::exception, but only when there are using-declarations or using-directives that bring std::exception or boost::exception into the global namespace. </p> <p> When &lt;math.h&gt; is included, user code must avoid all of the following at file scope (in the global namespace): using namespace std; using namespace boost; using std::exception; using boost::exception; </p> <ol start="3"><li>Possible Solution. </li></ol><ul><li>Remove line: </li></ul><blockquote> <blockquote> <p> using namespace std; </p> </blockquote> </blockquote> <ul><li>Replace all 'cout' invocations with 'std::cout' </li></ul> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10975 Trac 1.4.3 Sergey.Sprogis@… Fri, 30 Jan 2015 20:33:45 GMT owner, component changed https://svn.boost.org/trac10/ticket/10975#comment:1 https://svn.boost.org/trac10/ticket/10975#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">René Rivera</span> to <span class="trac-author">Joel de Guzman</span> </li> <li><strong>component</strong> <span class="trac-field-old">Regression Testing</span> → <span class="trac-field-new">spirit</span> </li> </ul> <p> In addition to fixe inside match_tests.cpp described in original filings, 15 more tests from spirit/classic/test directory listed below should be similarly modified. From all of them "using namespace std" should be removed, and std:: prefix should be added to the proper STL functions. </p> <p> 11 tests with require removing "using namespace std" only: </p> <p> grammar_tests.cpp operators_tests.cpp subrule_tests.cpp </p> <p> closure_tests.cpp </p> <p> parametric_tests.cpp </p> <p> switch_tests_eps_default.cpp </p> <p> switch_tests_general_def.cpp </p> <p> switch_tests_single.cpp </p> <p> switch_tests_wo_default.cpp </p> <p> switch_tests_single.cpp </p> <p> loops_tests.cpp </p> <p> 4 tests which require to add std:: prefix: </p> <p> scanner_tests.cpp : cout, list </p> <p> primitives_tests.cpp : cout </p> <p> directives_tests.cpp : cout, endl, string </p> <p> rule_tests.cpp : cout, endl </p> Ticket Joel de Guzman Fri, 30 Jan 2015 23:27:22 GMT <link>https://svn.boost.org/trac10/ticket/10975#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10975#comment:2</guid> <description> <p> It would be good if you can provide a pull request for this: <a class="ext-link" href="https://github.com/boostorg/spirit"><span class="icon">​</span>https://github.com/boostorg/spirit</a>. Thanks! </p> </description> <category>Ticket</category> </item> <item> <author>Aparna Kumta <aparna.kumta@…></author> <pubDate>Thu, 22 Oct 2015 21:10:08 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10975#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10975#comment:3</guid> <description> <p> Can <a class="ext-link" href="https://github.com/boostorg/spirit/pull/136"><span class="icon">​</span>https://github.com/boostorg/spirit/pull/136</a> be pulled in? Thanks. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Thu, 22 Oct 2015 21:41:29 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10975#comment:4 https://svn.boost.org/trac10/ticket/10975#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket