Opened 15 years ago

Closed 14 years ago

Last modified 14 years ago

#1285 closed Bugs (fixed)

[serialization] problem when including shared_ptr_132.hpp

Reported by: huangsean@… Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.34.1 Severity: Problem
Keywords: Cc:

Description

It seems that the "using namespace ." statements in this and shared_count_132.hpp trigger a problem in VC8 + SP1.

Try the following small program:

#include <boost/serialization/shared_ptr_132.hpp> #include <boost/cstdint.hpp>

typedef unsigned short uint16_t;

int main(int argc, char* argv[]) {

uint16_t u;

return 0;

}

Will result in this error:

error C2872: 'uint16_t' : ambiguous symbol

It seems that the workaround implemented for Borland should be extended to VC8 too:

#if !BOOST_WORKAROUND( BORLANDC, BOOST_TESTED_AT( 0x560) ) using namespace boost; #endif

Change History (11)

comment:1 by huangsean@…, 15 years ago

Forgot to mention this only happens with debug build. Release version is OK. I turned off the iterator debuging but that did not fix the problem.

comment:2 by anonymous, 15 years ago

Please ignore the above comment. It was meant to another defect I submitted

comment:3 by Robert Ramey, 15 years ago

Resolution: fixed
Status: newclosed

try using boost::uint16_t

Robert Ramey

comment:4 by huangsean@…, 15 years ago

Resolution: fixed
Status: closedreopened

Using boost::uint16_t would not be a solution. We have our own uint16_t typedef in our own namespace. Please consider the workaround in my original post. We had to patch our local boost versions that way.

comment:5 by Robert Ramey, 15 years ago

Resolution: wontfix
Status: reopenedclosed

I'm very disinclined to do such a thing.

you've got your own uint16_t and there as boost one and for all I know and std:

This would resolve the ambiguity in a way that would hide it from other users and create surprising behavior.

comment:6 by Johan Råde, 15 years ago

Resolution: wontfix
Status: closedreopened

Using boost::uint16 instead of uint16_t is not a solution when the problematic uint16_t occurs in some (possible deeply nested) third party header. Especially not when there are third party source files that depend on that header.

Moreover, this problem is just a symptom of a more serious problem. Including the header text_iarchive.hpp with Boost 1.35 and MSVC 7.1 has the effect of dumping the entire content of namespace boost into the global scope. The following example illustrates that:


Expected behavior: Should not compile Observed behavior with Boost 1.34.1 and MSVC 7.1: Does not compile Observed behavior with Boost 1.35 and MSVC 7.1: Does compile

#include <boost/shared_ptr.hpp> #include <boost/archive/text_iarchive.hpp> shared_ptr<int> sp;

comment:7 by anonymous, 15 years ago

The example in my previous post got a bit mangled. Here we go again:

Expected behavior: Should not compile Observed behavior with Boost 1.34.1 and MSVC 7.1: Does not compile Observed behavior with Boost 1.35 and MSVC 7.1: Does compile

#include <boost/shared_ptr.hpp> #include <boost/archive/text_iarchive.hpp> shared_ptr<int> sp;

comment:8 by Robert Ramey, 15 years ago

Resolution: fixed
Status: reopenedclosed

fixed - will check in soon

comment:9 by Chaker Nakhli (www.javageneration.com), 14 years ago

Resolution: fixed
Severity: ShowstopperProblem
Status: closedreopened

This problem persists on boost 1.36. For instance, when <boost/archive/text_iarchive.hpp> is included, the symbols shared_ptr<T> and array<T,N> are available in the default namespace. This prevents correct compilation with /clr option on V8.0 SP1. A new ticket was submitted with number #2608.

comment:10 by Robert Ramey, 14 years ago

Resolution: fixed
Status: reopenedclosed

I think this is fixed in 1.37

Robert Ramey

comment:11 by Chaker Nakhli (www.javageneration.com), 14 years ago

It seems to be OK on 1.37. We had to migrate though (hope the serialization format did not change). Thank you Robert.

Note: See TracTickets for help on using tickets.