Make sure to diagnose use of declarations in the case where we create an implicit CXXThisExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78474 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 5d9b69c..cec1aea 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1139,6 +1139,8 @@
           MarkDeclarationReferenced(Loc, D);
           if (PerformObjectMemberConversion(This, D))
             return ExprError();
+          if (DiagnoseUseOfDecl(D, Loc))
+            return ExprError();
           return Owned(new (Context) MemberExpr(This, true, D,
                                                 Loc, MemberType));
         }