Boost logo

Boost Users :

Subject: [Boost-users] Regression in Boost.Variant with gcc6.3 in C++03 mode
From: dariomt_at_[hidden]
Date: 2017-06-27 12:09:37


Hi,

This is the simplest possible repro I could get:

#include <boost/variant.hpp>
class A {};
class B : private A {};
typedef boost::variant<A, B> variant_t;
int main()
{
    B b;
    variant_t v (b);
}

This used to work with Boost 1.59.0 but fails with 1.64.0

 Using wandbox I've found that:
- it started failing in 1.62.0
- clang does not have this problem
- newer and older versions of gcc do have the same problem

The error is miles long. I think the important parts are:

boost/type_traits/is_convertible.hpp:149:53: error: 'A' is an inaccessible
base of 'B'
error: no matching function for call to 'boost::variant<A, B>::variant(B&)'

It seems the metaprogramming messes up due to the private inheritance, and
decides that the variant<A,B> is *not* constructible from B

Workarounds are very welcome!
Switching to C++14 is not an option (yet).

Regards



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