]> granicus.if.org Git - clang/commit
MS ABI: Fix forming pointers to members of a base class
authorReid Kleckner <reid@kleckner.net>
Thu, 12 Jun 2014 19:49:17 +0000 (19:49 +0000)
committerReid Kleckner <reid@kleckner.net>
Thu, 12 Jun 2014 19:49:17 +0000 (19:49 +0000)
commit85f2aa90c23acc494ea5804f84e3ea780eaa1b54
tree4407e019c886cb9c87173c48c1b7557b15a49df6
parentcb4e543bc78da46d23c1df47b61d8dc417753a5b
MS ABI: Fix forming pointers to members of a base class

Previously we would calculate the inheritance model of a class when
requiring a pointer to member type of that class to be complete.  The
inheritance model is used to figure out how many fields are used by the
member pointer.

However, once we require a pointer to member of a derived class type to
be complete, we can form pointers to members of bases without
calculating the inheritance model for those bases.  This was causing
crashes on this simple test case:

  struct A {
    void f();
    void f(int);
  };
  struct B : public A {};
  void g() { void (B::*a)() = &B::f; }

Now we calculate the inheritance models of all base classes when
completing a member pointer type.

Fixes PR2007.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210813 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaType.cpp
test/CodeGenCXX/microsoft-abi-member-pointers.cpp