Fix MergeFunctionDecl implicit CC for static methods.

Patch by Alexander Zinenko!

llvm-svn: 175890
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 7e44e6b..f062c03 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/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;