summaryrefslogtreecommitdiff
path: root/bindgen-tests/tests/headers/doggo-or-null.hpp
blob: 9146e18996dd7ddcd5ff9bb6298e0de82f32c413 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// bindgen-flags: --opaque-type DoggoOrNull --with-derive-partialeq --with-derive-hash -- -std=c++14

class Doggo {
    int x;
};

class Null {};

/**
 * This type is an opaque union. Unions can't derive anything interesting like
 * Debug or Default, even if their layout can, because it would require knowing
 * which variant is in use. Opaque unions still end up as a `union` in the Rust
 * bindings, but they just have one variant. Even so, can't derive. We should
 * probably emit an opaque struct for opaque unions... but until then, we have
 * this test to make sure that opaque unions don't derive and still compile.
 */
union DoggoOrNull {
    Doggo doggo;
    Null none;
};