Fix MergeFunctionDecl implicit CC for static methods.

Patch by Alexander Zinenko!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175890 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 7e44e6b..f062c03 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -2328,9 +2328,10 @@
     RequiresAdjustment = true;
 
   // Don't complain about mismatches when the default CC is
-  // effectively the same as the explict one.
+  // effectively the same as the explict one. Only Old decl contains correct
+  // information about storage class of CXXMethod.
   } else if (OldTypeInfo.getCC() == CC_Default &&
-             isABIDefaultCC(*this, NewTypeInfo.getCC(), New)) {
+             isABIDefaultCC(*this, NewTypeInfo.getCC(), Old)) {
     NewTypeInfo = NewTypeInfo.withCallingConv(OldTypeInfo.getCC());
     RequiresAdjustment = true;