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

            Bug ID: 16406
           Summary: [-cxx-abi microsoft] Wrong layout due to mistakenly
                    injected vtorDisp
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

=== vtordisp_layout.cpp ===
class A { 
  virtual void f();
};

class B : virtual A { 
  virtual void f();
};

class C : virtual B {}; 

extern "C" int printf(const char *fmt, ...);

int main() {
  printf("sizeof(C) = %lu\n", sizeof(C));
}
===========================

As of r184536,
$ clang -cc1 -fno-rtti -fdump-record-layouts -cxx-abi microsoft
-triple=i386-pc-win32 -emit-llvm-only -o - vtordisp_layout.cpp

prints out

*** Dumping AST Record Layout
   0 | class B
   0 |   (B vbtable pointer)
   4 |   (vtordisp for vbase A)
   8 |   class A (virtual base)
   8 |     (A vftable pointer)
     | [sizeof=12, dsize=12, align=4
     |  nvsize=4, nvalign=4]


*** Dumping AST Record Layout
   0 | class C
   0 |   (C vbtable pointer)
   4 |   (vtordisp for vbase A)
   8 |   class A (virtual base)
   8 |     (A vftable pointer)
  12 |   class B (virtual base)
  12 |     (B vbtable pointer)
     | [sizeof=16, dsize=16, align=4
     |  nvsize=4, nvalign=4]

There should not be vtordisp in B, nor should it be in C.

sizeof(B) should be 8, sizeof(C) should be 12.

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