Given a reference to a pointer to member whose class's inheritance model
is unspecified, make sure we come up with an inheritance model in
plausible places. One place we were missing involved LValue to RValue
conversion, another involved unary type traits.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247248
91177308-0d34-0410-b5e6-
96231b3b80d8
if (T.hasQualifiers())
T = T.getUnqualifiedType();
+ if (T->isMemberPointerType() &&
+ Context.getTargetInfo().getCXXABI().isMicrosoft())
+ RequireCompleteType(E->getExprLoc(), T, 0);
+
UpdateMarkingForLValueToRValue(E);
// Loading a __weak object implicitly retains the value, so we need a cleanup to
<< OpSpelling << RHSType << RHS.get()->getSourceRange();
return QualType();
}
+ //if (Context.getTargetInfo().getCXXABI().isMicrosoft())
+ // RequireCompleteType(Loc, QualType(MemPtr, 0), 0);
QualType Class(MemPtr->getClass(), 0);
QualType T = E->getType();
// Fast path the case where the type is already complete.
- if (!T->isIncompleteType())
+ if (!T->isIncompleteType()) {
+ if (T->isMemberPointerType() &&
+ Context.getTargetInfo().getCXXABI().isMicrosoft())
+ RequireCompleteType(E->getExprLoc(), T, 0);
// FIXME: The definition might not be visible.
return false;
+ }
// Incomplete array types may be completed by the initializer attached to
// their definitions. For static data members of class templates and for
// CHECK-LABEL: define void @"\01?f@PR24703@@YAXAAPQS@1@H@Z"(
}
+namespace ReferenceToMPTWithIncompleteClass {
+struct S;
+struct J;
+struct K;
+extern K *k;
+
+// CHECK-LABEL: @"\01?f@ReferenceToMPTWithIncompleteClass@@YAIAAPQS@1@H@Z"(
+// CHECK: ret i32 12
+unsigned f(int S::*&p) { return sizeof p; }
+
+// CHECK-LABEL: @"\01?g@ReferenceToMPTWithIncompleteClass@@YA_NAAPQJ@1@H0@Z"(
+bool g(int J::*&p, int J::*&q) { return p == q; }
+
+// CHECK-LABEL: @"\01?h@ReferenceToMPTWithIncompleteClass@@YAHAAPQK@1@H@Z"(
+int h(int K::*&p) { return k->*p; }
+}