Re: [Boost-bugs] [Boost C++ Libraries] #3730: compilation problem with is_virtual_base_of when class contains abstract methods

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3730: compilation problem with is_virtual_base_of when class contains abstract methods
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-12-08 16:22:14


#3730: compilation problem with is_virtual_base_of when class contains abstract
methods
----------------------------------------------------+-----------------------
 Reporter: Barry Searle <barry.searle@…> | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: Boost 1.42.0 | Component: type_traits
  Version: Boost 1.41.0 | Severity: Problem
 Keywords: |
----------------------------------------------------+-----------------------

Comment(by johnmaddock):

 I can't at present see a way to fix this, here's a reduced test case:

 {{{

 #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;
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3730#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC