Teach Sema how to pop out of friend function definitions in nested classes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79291 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 068978c..2de3484 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -3590,6 +3590,9 @@
                                           Redeclaration);
   FD = cast_or_null<FriendFunctionDecl>(ND);
 
+  assert(FD->getDeclContext() == DC);
+  assert(FD->getLexicalDeclContext() == CurContext);
+
   // If this is a dependent context, just add the decl to the
   // class's decl list and don't both with the lookup tables.  This
   // doesn't affect lookup because any call that might find this