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: Sergey.Sprogis@… Owned by: James E. King, III
Milestone: Boost 1.69 Component: assign
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:

Description

  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

  1. 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;

  1. 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 Sergey.Sprogis@…, 8 years ago

Component: Regression Testingassign
Owner: changed from René Rivera to Thorsten Ottosen

comment:2 by Aparna Kumta <aparna.kumta@…>, 7 years ago

comment:3 by James E. King, III, 4 years ago

Milestone: To Be DeterminedBoost 1.69
Owner: changed from Thorsten Ottosen to James E. King, III

comment:4 by James E. King, III, 4 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.