Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2007-04-25 05:37:56


Stefan Felkel wrote:
> Hi there,
>
> I have a strange compiler effect with Microsoft Visual Studio.NET
> 2003 and boost 1.33.1 in a project that uses bind and regex. All
> Symbols defined in an unnamed namespace are part of the namespace
> boost::re_detail::'anonymous-namespace'. The effect occurres when I
> use precompiled headers and bind.hpp is included before regex.hpp.
>
> This is my stdafx.h which is used to generate the precompiled header:
>
> #pragma once
>
> #include <boost/bind.hpp>
> #include <boost/regex.hpp>
>
> This is the main source file:
>
> #include "stdafx.h"
> #include "boost/current_function.hpp"
>
> namespace {
> void foo( void )
> {
> printf( "%s\n", BOOST_CURRENT_FUNCTION );
> }
> }
>
> int main( int argc, char * argv[] )
> {
> foo();
> return 1;
> }
>
> The program generates this output:
>
> void __cdecl boost::re_detail::`anonymous-namespace'::foo(void)
>
> instead of the expected output:
>
> void __cdecl `anonymous-namespace'::foo(void)
>
> When I change the include order in stdafx.h so that regex.hpp is
> included before bind.hpp the output is as expected.
> Has someone else came across such a problem? Is it a compiler bug?

Weird indeed, I don't believe it's our problem as such: except that both
regex and bind use unnamed namespaces. Looks like the poor compiler is
getting confused :-(

John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net