Audit uses of Sema::LookupSingleName for those lookups that are
intended for redeclarations, fixing those that need it. Fixes PR6831.

This uncovered an issue where the C++ type-specifier-seq parsing logic
would try to perform name lookup on an identifier after it already had
a type-specifier, which could also lead to spurious ambiguity errors
(as in PR6831, but with a different test case).

llvm-svn: 101419
diff --git a/clang/test/CXX/temp/temp.param/p3.cpp b/clang/test/CXX/temp/temp.param/p3.cpp
index 8fcc2dc..dc40c4b 100644
--- a/clang/test/CXX/temp/temp.param/p3.cpp
+++ b/clang/test/CXX/temp/temp.param/p3.cpp
@@ -26,3 +26,15 @@
     // expected-error{{no viable conversion}}
   } 
 };
+
+namespace PR6831 {
+  namespace NA { struct S; }
+  namespace NB { struct S; }
+
+  using namespace NA;
+  using namespace NB;
+
+  template <typename S> void foo();
+  template <int S> void bar();
+  template <template<typename> class S> void baz();
+}
diff --git a/clang/test/SemaCXX/exceptions.cpp b/clang/test/SemaCXX/exceptions.cpp
index e009558..18349d1 100644
--- a/clang/test/SemaCXX/exceptions.cpp
+++ b/clang/test/SemaCXX/exceptions.cpp
@@ -107,3 +107,16 @@
   }
   virtual void test () = 0; // expected-note{{pure virtual function 'test'}}
 };
+
+namespace PR6831 {
+  namespace NA { struct S; }
+  namespace NB { struct S; }
+  
+  void f() {
+    using namespace NA;
+    using namespace NB;
+    try {
+    } catch (int S) { 
+    }
+  }
+}