Diagnose class members that shadow a template parameter. Fixes
<rdar://problem/6952203>. 

To do this, we actually remove a not-quite-correct optimization in the
C++ name lookup routines. We'll revisit this optimization for the
general case once more C++ is working.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73659 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 3c6f706..7746035 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -3807,6 +3807,14 @@
     Diag(D.getDeclSpec().getThreadSpecLoc(), diag::err_invalid_thread);
 
   NamedDecl *PrevDecl = LookupName(S, II, LookupMemberName, true);
+
+  if (PrevDecl && PrevDecl->isTemplateParameter()) {
+    // Maybe we will complain about the shadowed template parameter.
+    DiagnoseTemplateParameterShadow(D.getIdentifierLoc(), PrevDecl);
+    // Just pretend that we didn't see the previous declaration.
+    PrevDecl = 0;
+  }
+
   if (PrevDecl && !isDeclInScope(PrevDecl, Record, S))
     PrevDecl = 0;