[Boost-bugs] [Boost C++ Libraries] #10984: libs/assign/test/basic.cpp Error: The name exception is ambiguous, exception and boost::exception

Subject: [Boost-bugs] [Boost C++ Libraries] #10984: libs/assign/test/basic.cpp Error: The name exception is ambiguous, exception and boost::exception
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-01-30 03:27:07


#10984: libs/assign/test/basic.cpp Error: The name exception is ambiguous,
exception and boost::exception
------------------------------+--------------------------------
 Reporter: Sergey.Sprogis@… | Owner: grafik
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: Regression Testing
  Version: Boost 1.57.0 | Severity: Problem
 Keywords: |
------------------------------+--------------------------------
 1. Description of the failure
 ==============================
 On Solaris 11.2 Oracle Studio 12.4 C++ compiler under -std=c++11 option
 produces the following error messages
 for libs/assign/test/basic.cpp

 "/usr/include/math.h", line 215: Error: The name exception is ambiguous,
 exception and boost::exception.

 and actually it produces similar error messages for small test like this:

  namespace boost {
   class exception;
  }
  using namespace boost;
  #include <algorithm>

 Note that in the original boost harness "class exception;" can be found
 inside: boost/exception/exception.hpp

 2. Cause of the failure.
 ========================
 This is a C++ vs Unix or Boost vs Unix issue.

 Standard Unix requires "struct exception" in the global namespace when
 <math.h> 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.

 When <math.h> 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;

 3. Possible Solution.
 ======================
  - Remove 2 lines:

      using namespace std;
      using namespace boost;

  - Add std:: prefix to all 'vector', 'map', 'string' invocations.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10984>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC