Boost logo

Boost :

From: Stephan Diederich (stephan.diederich_at_[hidden])
Date: 2008-06-17 09:39:53


Hi,

after upgrading to gcc 4.2.3 the following snippet fails to compile

#include <boost/concept_check.hpp>
struct MyVisitor{};
namespace test{ struct MyVisitor{};}
namespace{ struct MyVisitorAnon{};}

int main(){
   using namespace boost;
   function_requires<CopyConstructible<MyVisitor> >();
   function_requires<CopyConstructible<test::MyVisitor> >();
   function_requires<CopyConstructible<MyVisitorAnon> >(); //this line
breaks the build
   return 0;
}

with the error message:
/usr/include/boost/concept_check.hpp: In instantiation of
'boost::CopyConstructible<<unnamed>::MyVisitorAnon>':
/usr/include/boost/concept/detail/has_constraints.hpp:40:
instantiated from 'const bool
boost::concept::not_satisfied<boost::CopyConstructible<<unnamed>::MyVisitorAnon>
>::value'
/usr/include/boost/concept/detail/has_constraints.hpp:43:
instantiated from
'boost::concept::not_satisfied<boost::CopyConstructible<<unnamed>::MyVisitorAnon>
>'
/usr/include/boost/mpl/if.hpp:67: instantiated from
'boost::mpl::if_<boost::concept::not_satisfied<boost::CopyConstructible<<unnamed>::MyVisitorAnon>
>, boost::concept::constraint<boost::CopyConstructible<<unnamed>::MyVisitorAnon>
>, boost::concept::requirement<boost::CopyConstructible<<unnamed>::MyVisitorAnon>
> >'
/usr/include/boost/concept/detail/general.hpp:19: instantiated from
'boost::concept::requirement_<void
(*)(boost::CopyConstructible<<unnamed>::MyVisitorAnon>)>'
/usr/include/boost/concept_check.hpp:43: instantiated from 'void
boost::function_requires(Model*) [with Model =
boost::CopyConstructible<<unnamed>::MyVisitorAnon>]'
/home/diederich/projects/tests/make/graph_concept.cpp:11:
instantiated from here
/usr/include/boost/concept_check.hpp:156: error:
'boost::concept::requirement<Model>::failed [with Model =
boost::concept::usage_requirements<boost::CopyConstructible<<unnamed>::MyVisitorAnon>
>]' is not a valid template argument for type 'void (*)()' because
function 'static void boost::concept::requirement<Model>::failed()
[with Model = boost::concept::usage_requirements<boost::CopyConstructible<<unnamed>::MyVisitorAnon>
>]' has not external linkage
/usr/include/boost/concept_check.hpp: In function 'void
boost::function_requires(Model*) [with Model =
boost::CopyConstructible<<unnamed>::MyVisitorAnon>]':
/home/diederich/projects/tests/make/graph_concept.cpp:11:
instantiated from here
/usr/include/boost/concept_check.hpp:43: error:
'boost::concept::requirement<Model>::failed [with Model =
boost::CopyConstructible<<unnamed>::MyVisitorAnon>]' is not a valid
template argument for type 'void (*)()' because function 'static void
boost::concept::requirement<Model>::failed() [with Model =
boost::CopyConstructible<<unnamed>::MyVisitorAnon>]' has not external
linkage

I found the error while compiling a module which uses
depth_first_search where a visitor is declared in an unnamed
namespace.
Can someone help me with that?

Thanks in advance,
Stephan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk