]> granicus.if.org Git - clang/commitdiff
Remove an implemented FIXME and extend test cases. Follow-up on Doug's review.
authorSebastian Redl <sebastian.redl@getdesigned.at>
Mon, 26 Jan 2009 19:54:48 +0000 (19:54 +0000)
committerSebastian Redl <sebastian.redl@getdesigned.at>
Mon, 26 Jan 2009 19:54:48 +0000 (19:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63032 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaType.cpp
test/SemaCXX/member-pointer.cpp

index d62e767a1c1198f291c2a0975d8ccfcd6a4ebd91..719938d9a3be1ab7229ae5e4cbda087b2324ee10 100644 (file)
@@ -642,15 +642,14 @@ QualType Sema::ObjCGetTypeForMethodDefinition(DeclTy *D) {
   return T;
 }
 
-/// UnwrapSimilarPointerTypes - If T1 and T2 are pointer types (FIXME:
-/// or pointer-to-member types) that may be similar (C++ 4.4),
-/// replaces T1 and T2 with the type that they point to and return
-/// true. If T1 and T2 aren't pointer types or pointer-to-member
-/// types, or if they are not similar at this level, returns false and
-/// leaves T1 and T2 unchanged. Top-level qualifiers on T1 and T2 are
-/// ignored. This function will typically be called in a loop that
-/// successively "unwraps" pointer and pointer-to-member types to
-/// compare them at each level.
+/// UnwrapSimilarPointerTypes - If T1 and T2 are pointer types  that
+/// may be similar (C++ 4.4), replaces T1 and T2 with the type that
+/// they point to and return true. If T1 and T2 aren't pointer types
+/// or pointer-to-member types, or if they are not similar at this
+/// level, returns false and leaves T1 and T2 unchanged. Top-level
+/// qualifiers on T1 and T2 are ignored. This function will typically
+/// be called in a loop that successively "unwraps" pointer and
+/// pointer-to-member types to compare them at each level.
 bool Sema::UnwrapSimilarPointerTypes(QualType& T1, QualType& T2)
 {
   const PointerType *T1PtrType = T1->getAsPointerType(),
index 4aa309846101e6dc274f0bcab19298a82a6784df..bcd3dd65e84f5140ee5edf168284207c831799e7 100644 (file)
@@ -4,6 +4,9 @@ struct A {};
 enum B { Dummy };
 namespace C {}
 struct D : A {};
+struct E : A {};
+struct F : D, E {};
+struct G : virtual D {};
 
 int A::*pdi1;
 int (::A::*pdi2);
@@ -29,4 +32,8 @@ void f() {
   // Conversion to member of derived.
   int D::*pdid = pdi1;
   pdid = pdi2;
+
+  // Fail conversion due to ambiguity and virtuality.
+  int F::*pdif = pdi1; // expected-error {{ambiguous conversion from pointer to member of base class 'struct A' to pointer to member of derived class 'struct F'}} expected-error {{incompatible type}}
+  int G::*pdig = pdi1; // expected-error {{conversion from pointer to member of class 'struct A' to pointer to member of class 'struct G' via virtual base 'struct D' is not allowed}} expected-error {{incompatible type}}
 }