Fix a few isObjectTypes that really need to be isIncompleteOrObject
types; add another use of RequireCompleteType.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67644 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index e2cda9d..a6cb24c 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -613,13 +613,14 @@
         << Type << Ex->getSourceRange());
 
     QualType Pointee = Type->getAsPointerType()->getPointeeType();
-    if (!Pointee->isVoidType() &&
-        RequireCompleteType(StartLoc, Pointee, diag::warn_delete_incomplete,
-                               Ex->getSourceRange()))
-      return ExprError();
-    else if (!Pointee->isObjectType())
+    if (Pointee->isFunctionType() || Pointee->isVoidType())
       return ExprError(Diag(StartLoc, diag::err_delete_operand)
         << Type << Ex->getSourceRange());
+    else if (!Pointee->isDependentType() &&
+             RequireCompleteType(StartLoc, Pointee, 
+                                 diag::warn_delete_incomplete,
+                                 Ex->getSourceRange()))
+      return ExprError();
 
     // FIXME: Look up the correct operator delete overload and pass a pointer
     // along.