This patch fixes a bug where clang doesn’t reject union fields of non-trivial struct types:
struct S0 {
id x;
};
struct S1 {
id y;
};
union U0 {
struct S0 s0; // no diagnostics.
struct S1 s1; // no diagnostics.
};
union U1 {
id x; // clang rejects ObjC pointer fields in unions.
};
void test(union U0 a) {
// Both ‘S0::x’ and ‘S1::y' are destructed in the IR.
}rdar://problem/46677858