Opened 8 years ago
Closed 4 years ago
#10984 closed Bugs (fixed)
libs/assign/test/basic.cpp Error: The name exception is ambiguous, exception and boost::exception
Reported by: | Owned by: | James E. King, III | |
---|---|---|---|
Milestone: | Boost 1.69 | Component: | assign |
Version: | Boost 1.57.0 | Severity: | Problem |
Keywords: | Cc: |
Description
- 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
- 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;
- Possible Solution.
======================
- Remove 2 lines:
using namespace std; using namespace boost;
- Add std:: prefix to all 'vector', 'map', 'string' invocations.
Change History (4)
comment:1 by , 8 years ago
Component: | Regression Testing → assign |
---|---|
Owner: | changed from | to
comment:2 by , 7 years ago
comment:3 by , 4 years ago
Milestone: | To Be Determined → Boost 1.69 |
---|---|
Owner: | changed from | to
comment:4 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
PR: https://github.com/boostorg/assign/pull/11 has been submitted.