Delay parsing of default arguments of member functions until the class
is completely defined (C++ [class.mem]p2).

Reverse the order in which we process the definitions of member
functions specified inline. This way, we'll get diagnostics in the
order in which the member functions were declared in the class.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61103 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp
index fe9ae07..f023fbf 100644
--- a/lib/Sema/SemaCXXScopeSpec.cpp
+++ b/lib/Sema/SemaCXXScopeSpec.cpp
@@ -134,7 +134,8 @@
   assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");

   assert(PreDeclaratorDC == 0 && "Previous declarator context not popped?");

   PreDeclaratorDC = static_cast<DeclContext*>(S->getEntity());

-  S->setEntity(static_cast<DeclContext*>(SS.getScopeRep()));

+  CurContext = static_cast<DeclContext*>(SS.getScopeRep());

+  S->setEntity(CurContext);

 }

 

 /// ActOnCXXExitDeclaratorScope - Called when a declarator that previously

@@ -147,4 +148,9 @@
   assert(S->getEntity() == SS.getScopeRep() && "Context imbalance!");

   S->setEntity(PreDeclaratorDC);

   PreDeclaratorDC = 0;

+

+  // Reset CurContext to the nearest enclosing context.

+  while (!S->getEntity() && S->getParent())

+    S = S->getParent();

+  CurContext = static_cast<DeclContext*>(S->getEntity());

 }