[LLVMbugs] [Bug 16759] New: [-cxx-abi microsoft] Should issue a compiler error for class hierarchies we can't lay out vftables for

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 31 02:22:13 PDT 2013


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

            Bug ID: 16759
           Summary: [-cxx-abi microsoft] Should issue a compiler error for
                    class hierarchies we can't lay out vftables for
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: timurrrr at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Example:
------------------------
struct C0 { int x; };
struct C1 : C0 { virtual void f(); int y; };
// Converting C0* to C1* is non-trivial

struct A {
  virtual C0 *foo();  // in vftable slot #0.
  virtual C0 *bar();  // in vftable slot #1.
};

struct B : virtual A {
  virtual C1 *foo(); // appended to the A subobject's vftable in slot #2.
};

struct C : virtual A {
  virtual C1 *bar(); // appended to the A subobject's vftable in slot #2.
};

struct D : B, C {};
// It's ambiguous what's in the slot #2 of the A subobject's vftable.
------------------------

CL issues this compiler error:
"vftable.cpp(17) : error C2250: 'D' : ambiguous inheritance of 'C1
*A::foo(void)'",
Clang should do something similar. Currently, it just lays out the vftable,
putting foo() at the end, thus such code may misbehave at run time.

-- 
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/20130731/b3211253/attachment.html>


More information about the llvm-bugs mailing list