[LLVMbugs] [Bug 19181] New: MS ABI: Layout of derived class with empty base is wrong
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Mar 18 14:00:40 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=19181
Bug ID: 19181
Summary: MS ABI: Layout of derived class with empty base is
wrong
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: david.majnemer at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
consider:
extern "C" int printf(const char *, ...);
static char buffer[419430400];
inline void *operator new(size_t, void *pv) { return pv; }
struct A {};
struct B : public A {
int Fiel1;
B() {
printf("Fiel1 : %lu\n", ((char *)&Fiel1 - (char *)&buffer));
}
};
struct C {
int Fiel2;
};
struct D : public A, public C {
int Fiel3;
};
struct E : public D, public B {
int Fiel4;
};
int main() { new (buffer) E; }
MSVC gives us:
Fiel1 : 8
clang gives us:
Fiel1 : 12
--
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/20140318/09f32c5e/attachment.html>
More information about the llvm-bugs
mailing list