Boost logo

Boost :

Subject: [boost] bug in type_traits/is_virtual_base_of ??
From: Daniel Larimer (dlarimer_at_[hidden])
Date: 2010-02-11 01:15:43


Using boost 1_41 I found what I believe to be a bug in is_virtual_base_of. The following code reports that A and B are both virtual base classes of C.

#include<boost/type_traits/is_virtual_base_of.hpp>
#include <stdio.h>
struct A
{
   int base_old;
};
struct B
{
   int base_data;
};
        
struct C : public A, public B
{
    virtual void test(){};
    float my_data;
};
    
int main ( int argc, char** argv )
{
    printf( "is_virtual_base_of<A,C>::value: %d\n", boost::is_virtual_base_of<A,C>::value );
    printf( "is_virtual_base_of<B,C>::value: %d\n", boost::is_virtual_base_of<B,C>::value );
}

i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646) (dot 1)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


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