Boost logo

Boost Users :

Subject: Re: [Boost-users] Regression in Boost.Variant with gcc6.3 in C++03 mode
From: d25fe0be_at_[hidden]
Date: 2017-06-28 14:31:06


> On 28 Jun 2017, at 16:52, dariomt_at_[hidden] wrote:
>
>
>
> 2017-06-27 20:05 GMT+02:00 d25fe0be_at_[hidden] <d25fe0be_at_[hidden]>:
> Sorry I missed John's reply..
>
> I believe John is right, without C++11 a fully conforming is_convertible seems not to be implementable (I didn't find a way to remove `_m_check` taking the inaccessible base as a parameter from the overload set.), hence 'your own `is_convertible`' seems not to be feasible either.
>
> Thank you John for pointing this out, and sorry for the noise.
>
> Thanks for the follow up.
>
> So the only workaround with 1.64 is to get rid of the private inheritance, right?

I'm afraid yes.

> Anyway, my test case used to work in older versions of Boost.
> I'm not sure about what changed between 1.61 and 1.62, if it's a change in type_traits or a change in variant.
> Would it be possible to recover the lost functionality in 1.65?
>

I think the change was introduced by commit [https://github.com/boostorg/variant/commit/b3650685f941a0c35cadfd878a185f274e132788], which tried to solve ticket #11602 [https://svn.boost.org/trac10/ticket/11602].

I don't know how can both #11602 and the issue here be solved at the same time. CC'ing Antony.

Perhaps we can test for convertibility only if C++11 is available, and leave #11602 unsolved in C++03 (as there're still corner cases not solved as of now, see below)?

---
As `boost::is_constructible` triggers a hard error when testing a class and its privately parent, the following code fails the compilation as well (both before (because of #11602) and after (because of the hard error triggered by `boost::is_convertible`) commit b3650685f941a0c35cadfd878a185f274e132788):
```
#include <boost/variant.hpp>
class A {};
class B : private A {};
void foo(boost::variant<A> v) {}
void foo(boost::variant<B> v) {}
int main()
{
    B b;
    foo(b);
}
```

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