<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On May 29, 2012, at 3:57 AM, r4start wrote:</div><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000">This patch fixes the following problem:<br>
    struct first {<br>
        virtual void asdf() {}<br>
        virtual void g(){}<br>
        };<br>
        <br>
      struct second : virtual first {<br>
        int q;<br>
          virtual void asdf() { q = 90; }<br>
          virtual void g(){ q = 12; }<br>
      };<br>
        <br>
      struct third : virtual second {};<br>
        void test2() { third *t; }<br>
    <br>
    In clang "second" has vtordisp for "first", but MSVC doesn`t
    generate vtordisp for "first".<br>
    According msdn " If a derived class overrides a virtual function
    that it inherits from a virtual base class,<b> and if a constructor
      or destructor for the derived class calls that function using a
      pointer to the virtual base class</b>, the compiler may introduce
    additional hidden "vtordisp" fields into classes with virtual bases.
    ".<br>
    So in in this example "second" will not have vtordisp for "first".
    But if we add constructor or destructor in "second" then MSVC add
    vtordisp.<br></div></blockquote></div><br><div>Is this the rule used by MSVC?  For example, does a vtordisp still get emitted even if a ctor "obviously" doesn't call any virtual functions, like if it's defined in the class definition and obviously empty?  Please test both an empty ctor and an empty dtor.</div><div><br></div><div>Please also add testcases verifying that we do the right thing in further-derived classes that provide ctors.  For example:</div><div>  struct A { virtual void foo(); };</div><div>  struct B : virtual A { virtual void foo(); }; // no vtordisp</div><div>  struct Test1 : B { Test1(); };</div><div>  struct Test2 : virtual B { Test2(); };</div><div>  struct Test3 : B { Test3(); virtual void foo(); };</div><div>  struct Test4 : virtual B { Test4(); virtual void foo(); };</div><div>  </div><div>John.</div></body></html>