Make SemaAccess smarter about determining when a dependent class might
instantiate to match a friend class declaration. It's still pretty dumb,
though.

llvm-svn: 264189
diff --git a/clang/test/CXX/drs/dr5xx.cpp b/clang/test/CXX/drs/dr5xx.cpp
index 96d3494..e0bab57 100644
--- a/clang/test/CXX/drs/dr5xx.cpp
+++ b/clang/test/CXX/drs/dr5xx.cpp
@@ -814,7 +814,7 @@
   }
 }
 
-namespace dr580 { // dr580: no
+namespace dr580 { // dr580: partial
   class C;
   struct A { static C c; };
   struct B { static C c; };
@@ -822,7 +822,7 @@
     C(); // expected-note {{here}}
     ~C(); // expected-note {{here}}
 
-    typedef int I; // expected-note {{here}}
+    typedef int I; // expected-note 2{{here}}
     template<int> struct X;
     template<int> friend struct Y;
     template<int> void f();
@@ -832,7 +832,20 @@
 
   template<C::I> struct C::X {};
   template<C::I> struct Y {};
-  template<C::I> struct Z {}; // FIXME: should reject, accepted because C befriends A!
+  template<C::I> struct Z {}; // expected-error {{private}}
+
+  struct C2 {
+    class X {
+      struct A;
+      typedef int I;
+      friend struct A;
+    };
+    class Y {
+      template<X::I> struct A {}; // FIXME: We incorrectly accept this
+                                  // because we think C2::Y::A<...> might
+                                  // instantiate to C2::X::A
+    };
+  };
 
   template<C::I> void C::f() {}
   template<C::I> void g() {}
diff --git a/clang/test/SemaCXX/access.cpp b/clang/test/SemaCXX/access.cpp
index cd65f90..29a58a13 100644
--- a/clang/test/SemaCXX/access.cpp
+++ b/clang/test/SemaCXX/access.cpp
@@ -167,5 +167,5 @@
   template <class T> void foo() {
     []() { A::foo(); }(); // expected-error {{private}}
   }
-  void bar() { foo<void>(); } // expected-note {{instantiation}}
+  void bar() { foo<void>(); }
 }