Subject: [Boost-bugs] [Boost C++ Libraries] #11323: is_virtual_base_of fails to build when virtual bases and their ancestors define identical virtual functions
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-05-19 17:36:07
#11323: is_virtual_base_of fails to build when virtual bases and their ancestors
define identical virtual functions
----------------------------------+-------------------------
Reporter: leandro.gracia.gil@⦠| Owner: johnmaddock
Type: Bugs | Status: new
Milestone: To Be Determined | Component: type_traits
Version: Boost 1.57.0 | Severity: Problem
Keywords: |
----------------------------------+-------------------------
The following code snippet fails to build in clang 6.0:
{{{
#include <iostream>
#include <boost/type_traits.hpp>
struct A { virtual void foo() {} };
struct B : public virtual A { virtual void foo() {} };
struct C : public B {};
int main() {
std::cout << boost::is_virtual_base_of<B, C>::value << std::endl;
return 0;
}
}}}
This is the compiler error it throws:
{{{
/usr/local/include/boost/type_traits/is_virtual_base_of.hpp:55:12: error:
virtual function 'A::foo' has more than one final overrider in
'boost_type_traits_internal_struct_X'
struct boost_type_traits_internal_struct_X : public Derived, virtual
Base
(...)
}}}
The problem can be temporarily worked around by redefining virtual void
foo() {} into boost_type_traits_internal_struct_X, but that does not scale
as we would need to know and override every single virtual method that
appears both in A and B.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11323> 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:18 UTC