Parse constructor names in friend declarations.  Part of the fix for
PR6207.

llvm-svn: 101119
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 171bee6..005311f 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3188,6 +3188,10 @@
     if (CheckMemberSpecialization(NewFD, Previous))
       NewFD->setInvalidDecl();
   }
+
+  // Make sure this is set before checking the function declaration.
+  // We'll override the visibility type later.
+  if (isFriend) NewFD->setObjectOfFriendDecl(false);
     
   // Perform semantic checking on the function declaration.
   bool OverloadableAttrRequired = false; // FIXME: HACK!
@@ -3199,7 +3203,10 @@
          "previous declaration set still overloaded");
 
   if (isFriend && Redeclaration) {
-    AccessSpecifier Access = NewFD->getPreviousDeclaration()->getAccess();
+    AccessSpecifier Access = AS_public;
+    if (!NewFD->isInvalidDecl())
+      Access = NewFD->getPreviousDeclaration()->getAccess();
+
     if (FunctionTemplate) {
       FunctionTemplate->setObjectOfFriendDecl(true);
       FunctionTemplate->setAccess(Access);