[llvm-bugs] [Bug 46711] New: Clang and GCC disagree on the definition of "POD for the purpose of layout" for classes with a defaulted/deleted constructor/destructor/copy or move assignment operator
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jul 14 03:44:08 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46711
Bug ID: 46711
Summary: Clang and GCC disagree on the definition of "POD for
the purpose of layout" for classes with a
defaulted/deleted constructor/destructor/copy or move
assignment operator
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: riccibrun at gmail.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
For targets using the C++03 definition of POD for ABI purposes, GCC allows a
class type to be "POD for the purpose of layout" if the class has a defaulted
or deleted constructor/destructor/copy or move assignment operator. Clang does
not. Example:
struct S {
int i;
char b;
~S() = default;
};
struct T : S {
char c;
};
int i = sizeof(T); // 12 with GCC, 8 with Clang (on x86-64)
(https://godbolt.org/z/sbsM54)
This is not a new issue; GCC has this behaviour since at least GCC 4.5.3, and
clang has this behaviour since at least clang 3.0.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200714/b73b3e5b/attachment.html>
More information about the llvm-bugs
mailing list