Require the object type of a member access expression ("." or "->") to
be complete.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89042 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index fdce0e6..dd3fd2c 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -2141,12 +2141,19 @@
return move(Base);
}
+ // The object type must be complete (or dependent).
+ if (!BaseType->isDependentType() &&
+ RequireCompleteType(OpLoc, BaseType,
+ PDiag(diag::err_incomplete_member_access)))
+ return ExprError();
+
// C++ [basic.lookup.classref]p2:
// If the id-expression in a class member access (5.2.5) is an
- // unqualified-id, and the type of the object expres- sion is of a class
+ // unqualified-id, and the type of the object expression is of a class
// type C (or of pointer to a class type C), the unqualified-id is looked
// up in the scope of class C. [...]
ObjectType = BaseType.getAsOpaquePtr();
+
return move(Base);
}