Silently drop dependent friend function template specializations,
since we have absolutely no way to match them when they are declared
nor do we have a way to represent these parsed-but-not-checked friend
declarations.

llvm-svn: 99407
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index e802018..e4c930e2 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3130,10 +3130,17 @@
   }
 
   if (isFunctionTemplateSpecialization) {
-      if (CheckFunctionTemplateSpecialization(NewFD,
-                               (HasExplicitTemplateArgs ? &TemplateArgs : 0),
-                                              Previous))
-        NewFD->setInvalidDecl();
+    if (isFriend && NewFD->getType()->isDependentType()) {
+      // FIXME: When we see a friend of a function template
+      // specialization with a dependent type, we can't match it now;
+      // for now, we just drop it, until we have a reasonable way to
+      // represent the parsed-but-not-matched friend function template
+      // specialization in the AST.
+      return 0;
+    } else if (CheckFunctionTemplateSpecialization(NewFD,
+                                   (HasExplicitTemplateArgs ? &TemplateArgs : 0),
+                                                 Previous))
+      NewFD->setInvalidDecl();
   } else if (isExplicitSpecialization && isa<CXXMethodDecl>(NewFD) &&
              CheckMemberSpecialization(NewFD, Previous))
     NewFD->setInvalidDecl();