
Hi Robert, I just tried compiling our app with Boost 1.35 on Visual Studio 7.1. I got a lot of errors (ambiguous symbols, conflicts between Boost and other 3rd party headers). The problem seems to be that the header text_iarchive.hpp (but none of the >40 other boost headers that I'm using) puts the content of namespace boost at global scope. Here is a simple example that reproduces the problem ----------------------------------- // 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; ------------------------------------- --Johan Råde

Hmmm - I tried your example on my 7.1 environment and it compiled without error. Robert Ramey Johan Råde wrote:
Hi Robert,
I just tried compiling our app with Boost 1.35 on Visual Studio 7.1. I got a lot of errors (ambiguous symbols, conflicts between Boost and other 3rd party headers).
The problem seems to be that the header text_iarchive.hpp (but none of the >40 other boost headers that I'm using) puts the content of namespace boost at global scope.
Here is a simple example that reproduces the problem
-----------------------------------
// 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;
-------------------------------------
--Johan Råde
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Robert, The code should NOT compile. --Johan Robert Ramey wrote:
Hmmm - I tried your example on my 7.1 environment and it compiled without error.
// 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;

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost- bounces@lists.boost.org] On Behalf Of Johan Råde Sent: Wednesday, February 13, 2008 11:57 AM To: boost@lists.boost.org Subject: Re: [boost] [serialization] namespace boost
Robert,
The code should NOT compile.
// 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;
This is very similar (or the same) to http://svn.boost.org/trac/boost/ticket/1285. Unfortunately, Robert did not want to take the fix proposed. Regards, Sean

Sean Huang wrote:
This is very similar (or the same) to http://svn.boost.org/trac/boost/ticket/1285. Unfortunately, Robert did not want to take the fix proposed.
Regards,
Sean
It is exactly the same problem. --Johan

Hmmm, I'll take another look at it. Robert Ramey Johan Råde wrote:
Sean Huang wrote:
This is very similar (or the same) to http://svn.boost.org/trac/boost/ticket/1285. Unfortunately, Robert did not want to take the fix proposed.
Regards,
Sean
It is exactly the same problem.
--Johan
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

OK gurus - I looked into this a little bit and now I have a question. The code causing the problem looks like: namespace boost_132 { using namespace boost; // bunch of old code using boost namespace here } This was added to provide enough information in order to de-serialize shared pointers saved under the older system. By wrapping this in the namespace boost_132, it was my intention that the directive "using namespace boost;" apply only to the code in that namespace. It seems that the complaint is that its applying to code outside the namespace boost_132. Is my understanding of the scope of using directives wrong, or is this a compiler error? Then the question arises as to how it should be addressed. I don't see how the workaround for the borland compiler applies here. What I wanted to avoid was going through the code line by line. This is just imported code which in only there to support de-serialization of older archives which use shared pointer so I didn't want to create maintainence issue. So one thing is that the code should be included conditionally with something like BOOST_SERIALIZATION_SUPPORT_132_SHARED pointers. Aside from that I'm willing to hear ideas on this. Robert Ramey "Johan Råde" <rade@maths.lth.se> wrote in message news:fov8qu$63e$1@ger.gmane.org...
Sean Huang wrote:
This is very similar (or the same) to http://svn.boost.org/trac/boost/ticket/1285. Unfortunately, Robert did not want to take the fix proposed.
Regards,
Sean
It is exactly the same problem.
--Johan
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

I think your understanding is right and the problem is with VC8. The following compiles on VC8, but if you remove the template definition for whatever, it fails as expected. namespace useful {} namespace useless { using namespace useful; template<typename T> class whatever {}; } namespace useful { struct alice {}; } int main(int argc, char* argv[]) { alice u; return 0; } On Feb 13, 2008 3:40 PM, Robert Ramey <ramey@rrsd.com> wrote:
OK gurus - I looked into this a little bit and now I have a question.
The code causing the problem looks like:
namespace boost_132 { using namespace boost; // bunch of old code using boost namespace here }
This was added to provide enough information in order to de-serialize shared pointers saved under the older system. By wrapping this in the namespace boost_132, it was my intention that the directive "using namespace boost;" apply only to the code in that namespace.
It seems that the complaint is that its applying to code outside the namespace boost_132.
Is my understanding of the scope of using directives wrong, or is this a compiler error?
Then the question arises as to how it should be addressed. I don't see how the workaround for the borland compiler applies here. What I wanted to avoid was going through the code line by line. This is just imported code which in only there to support de-serialization of older archives which use shared pointer so I didn't want to create maintainence issue. So one thing is that the code should be included conditionally with something like BOOST_SERIALIZATION_SUPPORT_132_SHARED pointers. Aside from that I'm willing to hear ideas on this.
Robert Ramey
"Johan Råde" <rade@maths.lth.se> wrote in message news:fov8qu$63e$1@ger.gmane.org...
Sean Huang wrote:
This is very similar (or the same) to http://svn.boost.org/trac/boost/ticket/1285. Unfortunately, Robert did not want to take the fix proposed.
Regards,
Sean
It is exactly the same problem.
--Johan
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Allen Ding wrote:
I think your understanding is right and the problem is with VC8. The following compiles on VC8, but if you remove the template definition for whatever, it fails as expected.
I tested Allen's example with VC 7.1. I got exactly the behavior that he reports with VC8. (The code compiles. If you remove the template definition for whatever, then it fails to compile.) Maybe there should be a regression test for this problem. Something like: -------------------------------------------------- // Expected behavior: should not compile #include <boost/any.hpp> #include <boost/array.hpp> ... all Boost headers ... #include <boost/xpressive/xpressive.hpp> shared_ptr<int> sp; ------------------------------------------------ --Johan

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost- bounces@lists.boost.org] On Behalf Of Robert Ramey Sent: Wednesday, February 13, 2008 6:41 PM To: boost@lists.boost.org Subject: Re: [boost] [serialization] namespace boost
It seems that the complaint is that its applying to code outside the namespace boost_132.
Is my understanding of the scope of using directives wrong, or is this a compiler error? As said in the Trac ticket, this is a compiler bug
Then the question arises as to how it should be addressed. I don't see how the workaround for the borland compiler applies here. I do not know if this is best fix but it solved our problem and it was not too much effeot. I do not know your original intension for the Borland compiler #if but it seems Borland has the same namespace issue from looking at the code -- and that's why I proposed simply extending the #if condition to VC8 (looks like VC7.1 has the bug too from Johan's report)
What I wanted to avoid was going through the code line by line. There are only a few places that need the patch (and you already did that for Borland)
Regards, Sean
participants (4)
-
Allen Ding
-
Johan Råde
-
Robert Ramey
-
Sean Huang