Handle dependent friends more explicitly and deal with the possibility
of templated-scope friends by marking them invalid and white-listing all
accesses until such time as we implement them.  Fixes a crash, this time
without a broken test case.

llvm-svn: 116364
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 7f84405..cb76568 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3471,7 +3471,9 @@
 
   if (isFriend) {
     // DC is the namespace in which the function is being declared.
-    assert((DC->isFileContext() || !Previous.empty()) &&
+    assert((DC->isFileContext() || !Previous.empty() ||
+            (D.getCXXScopeSpec().isSet() &&
+             D.getCXXScopeSpec().getScopeRep()->isDependent())) &&
            "previously-undeclared friend function being created "
            "in a non-namespace context");