https://bugs.llvm.org/show_bug.cgi?id=51839
Bug ID: 51839
Summary: GCC and Clang disagree about packed record layout with
non-POD fields
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
Consider:
https://gcc.godbolt.org/z/P4EKvYfr5
struct NonPod {
NonPod(); // matters
long long i64;
};
struct __attribute__ ((packed)) Packed {
char c;
NonPod a;
};
int theSize = sizeof(Packed);
GCC gives a size of 16, while clang gives a size of 9.
GCC also produces this warning:
warning: ignoring packed attribute because of unpacked non-POD field 'NonPod
Packed::a'
7 | NonPod a;
| ^
At this point, changing Clang's behavior would probably be a major ABI break.
Presumably this is a no-go for distributors unconcerned with GCC compatibility.
Therefore, it seems we need a LangOpt or something to control this behavior.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs