[LLVMbugs] [Bug 18967] New: MS ABI: Bad this adjustment for virtual methods in a diamond virtual inheritance hierarchy

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 25 11:49:56 PST 2014


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

            Bug ID: 18967
           Summary: MS ABI: Bad this adjustment for virtual methods in a
                    diamond virtual inheritance hierarchy
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: rnk at google.com
          Reporter: rnk at google.com
                CC: hans at hanshq.net, llvmbugs at cs.uiuc.edu,
                    timurrrr at google.com
            Blocks: 12477, 18887
    Classification: Unclassified

Semi-reduced test case:

$ cat t.cpp
struct A {
  virtual int foo() { return a; }
  int a;
};
struct B : virtual A {
  B() : b(1) {}
  virtual int bar() { return b; }
  int b;
};
struct C : virtual A {
  C() : c(2) {}
  virtual int foo() { return c; }
  int c;
};
struct D : B, C {
  D() : d(3) {}
  virtual int bar() { return d; }
  int d;
};
int main() {
  D d;
  return d.foo();
}

$ clang-cl -GR- t.cpp && ./t.exe ; echo $?
3

This should return 2, not 3.  It's accessing 'd' instead of 'c'.

-- 
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/20140225/3a9baca3/attachment.html>


More information about the llvm-bugs mailing list