[PATCH] D55659: [Sema][ObjC] Disallow non-trivial C struct fields in unions
Akira Hatanaka via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 13 09:33:15 PST 2018
ahatanak created this revision.
ahatanak added a reviewer: rjmccall.
ahatanak added a project: clang.
Herald added subscribers: dexonsmith, jkorous.
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
Repository:
rC Clang
https://reviews.llvm.org/D55659
Files:
include/clang/AST/Type.h
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaDecl.cpp
test/SemaObjC/arc-decls.m
test/SemaObjCXX/objc-weak.mm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55659.178083.patch
Type: text/x-patch
Size: 8054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181213/91f212ea/attachment.bin>
More information about the cfe-commits
mailing list