Boost logo

Boost Users :

From: Jochen Hammann (jochen.hammann_at_[hidden])
Date: 2005-04-20 08:24:33


Joaquín Mª López Muñoz wrote:

> The information you're giving is very interesting! The fact that the problem
> does not appear when using tags seems to hint at a nasty complication with
> the joint use of boost::is_base_and_derived and pointers to members as used in
> boost::multi_index::member.
>
> I've attached a simple test case. Would you mind compiling it
> with and without /vmg? If it fails with /vmg, would you mind removing
> the type1 and type2 parts and leaving only type2?

I suppose you mean, that I should remove type1 and type2 parts and leave only type3? If that is
correct, than these are the results of the test:

1) The test (foo.cpp) - as attached to the posting - compiles without any errors, if the /vmg option
is *deactivated*.

2) The test (foo.cpp) - as attached to the posting - fails to compile with an internal compiler
error, if the /vmg option is *activated*. As you expected, the internal compiler error occurs in the
file 'is_base_and_derived.hpp' at BOOST_STATIC_CONSTANT() within the following struct:

template<typename B, typename D>
struct is_base_and_derived_impl2
{
     struct Host
     {
         operator B const volatile *() const;
         operator D const volatile *();
     };

     BOOST_STATIC_CONSTANT(bool, value =
         sizeof(bd_helper<B,D>::check_sig(Host(), 0)) == sizeof(type_traits::yes_type));
};

3) I have removed the type1 and type2 parts and have leaved the type3 part. Now, the test (foo.cpp)
compiles without any error, regardless of the /vmg compiler option. To ensure, that I have not
misunderstood you, the following code shows the modifications I made to foo.cpp:

#include <boost/config.hpp>
#include <boost/type_traits/is_base_and_derived.hpp>
#include <boost/multi_index/member.hpp>

struct marker{};

template<typename T>
struct is_marked
{
   BOOST_STATIC_CONSTANT(bool,value=(boost::is_base_and_derived<marker,T>::value));
};

struct foo
{
   int x;
};

struct bar:private marker
{
};

//typedef is_marked<int> type1;
//typedef is_marked<boost::multi_index::member<foo,int,&foo::x> > type2;
typedef is_marked<bar> type3;

int main()
{
   //bool b1=type1::value;
   //bool b2=type2::value;
   bool b3=type3::value;
   return 0;
}

I hope I could help you.

Regards,

     Jochen.


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