http://llvm.org/bugs/show_bug.cgi?id=17768
Bug ID: 17768
Summary: [-cxx-abi microsoft] clang doesn't layout derived
class on top of empty virtual base class
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
#include <stddef.h>
#include <stdio.h>
#include <string.h>
char buffer[419430400];
inline void *operator new(size_t, void *pv) { return pv; }
struct TypeName0 {
TypeName0() {
printf("TypeName0 (this): %llu\n", (unsigned long
long)((size_t)this - (size_t)buffer));
}
};
struct TypeName1: public TypeName0 {
char TypeName1FieldName5;
TypeName1() {
printf("TypeName1 (this): %llu\n", (unsigned long
long)((size_t)this - (size_t)buffer));
printf("TypeName1 (fiel): %llu\n", (unsigned long
long)((size_t)&TypeName1FieldName5 - (size_t)buffer));
}
};
struct TypeName2: public virtual TypeName0 {
int TypeName2FieldName0;
TypeName2() {
printf("TypeName2 (this): %llu\n", (unsigned long
long)((size_t)this - (size_t)buffer));
}
};
struct TypeName3: public virtual TypeName1, public virtual TypeName2 {
int TypeName3FieldName0;
TypeName3() {
printf("TypeName3 (this): %llu\n", (unsigned long
long)((size_t)this - (size_t)buffer));
printf("TypeName3 (fiel): %llu\n", (unsigned long
long)((size_t)&TypeName3FieldName0 - (size_t)buffer));
}
};
int main() {
memset(buffer, 0, sizeof(buffer));
new (buffer) TypeName3;
}
clang:
TypeName0 (this): 8
TypeName1 (this): 8
TypeName1 (fiel): 8
TypeName0 (this): 9
TypeName2 (this): 12
TypeName3 (this): 0
TypeName3 (fiel): 4
vs:
TypeName0 (this): 8
TypeName1 (this): 8
TypeName1 (fiel): 8
TypeName0 (this): 16
TypeName2 (this): 16
TypeName3 (this): 0
TypeName3 (fiel): 4
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs