http://llvm.org/bugs/show_bug.cgi?id=20315

            Bug ID: 20315
           Summary: MS ABI: Layout wrong for indirectly inherited packed
                    base
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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 : A {};
struct C {};
#pragma pack(push, 1)
struct D : B, virtual A, virtual C {
  int field;
  D() {
    printf("field: %d\n", (int)&field - (int)buffer);
  }
};
#pragma pack(pop)
struct E : D {};
struct F : A, E {};
template <typename Class> static void init_mem() {
  new (buffer) Class;
}
int main() {
  init_mem<F>();
}

we give:
field: 5

they give:
field: 8

-- 
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

Reply via email to