Boost logo

Boost :

Subject: [boost] [type_traits] Need help with an - unfixable? - issue
From: John Maddock (john_at_[hidden])
Date: 2009-12-08 11:24:50


This issue just came in: https://svn.boost.org/trac/boost/ticket/3730

Reduced to the test case below, and I can't see a way to fix this at
present, anyone any bright ideas?

Thanks, John.

#include <map>
#include <iostream>
#include <boost/type_traits.hpp>

class base {
public:
    base() : i(0) {}
    base(int i) : i(i)
    {
        m[i] = "text";
    }

    virtual void method1() = 0;

    virtual ~base() {};
private:
    int i;
    std::map<int, std::string> m;
};

class derived1 : virtual public base {
public:
};

class derived2 : virtual public base {
public:
};

class intermediate : public derived1, public derived2 {
public:
    intermediate() {}
    intermediate(int i) : base(i) {}

    void method1();
};

void intermediate::method1()
{
}

class final : public intermediate {
public:
    final() {}
    final(int i) : base(i) {}
};

//
// This class demonstrates what we need to make work inside
is_virtual_base_of.
// MSVC compiles this just fine (likewise is_virtual_base_of), and only
complains
// when attempting to use method1. Other compilers (GCC, Intel on Linux)
complain
// as soon as X is declared, likewise when instantiating is_virtual_base_of.
//
struct X : final, virtual intermediate
{
 X();
 X(const X&);
 X& operator=(const X&);
 ~X()throw();
};

int main( int /* argc */, char* /* argv */[] )
{
   X x;
   x.method1();
   boost::is_virtual_base_of<intermediate, final>::type t;
   return t.value != true;
}


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