Roland Dreier 1aa8dd1745 Fix assertion failure for unions (#1685) (#1709)
In def_readonly and def_readwrite, there is an assertion that the member comes
from the class or a base class:

    static_assert(std::is_base_of<C, type>::value, "...");

However, if C and type are the same type, is_base_of will still only be true
if they are the same _non-union_ type.  This means we can't define accessors
for the members of a union type because of this assertion.

Update the assertion to test

    std::is_same<C, type>::value || std::is_base_of<C, type>::value

which will allow union types, or members of base classes.

Also add a basic unit test for accessing unions.
2019-06-11 23:28:58 +02:00
..
2019-02-04 17:09:47 +01:00
2017-01-31 17:05:44 +01:00
2019-02-04 16:09:21 +01:00
2018-02-27 22:46:56 -04:00
2019-04-06 19:09:39 +02:00
2019-04-06 19:09:39 +02:00
2019-04-06 19:09:39 +02:00
2018-01-11 16:39:50 -04:00
2019-04-06 19:09:39 +02:00
2019-06-10 21:56:38 +02:00
2019-04-06 19:09:39 +02:00