No longer assuming the number of prototype arguments is always less than the number of formal parameters for a variadic function call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160570 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 9420b73..b80e374 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -10998,7 +10998,7 @@
   // If this is a variadic call, handle args passed through "...".
   if (Proto->isVariadic()) {
     // Promote the arguments (C99 6.5.2.2p7).
-    for (unsigned i = NumArgsInProto; i != NumArgs; i++) {
+    for (unsigned i = NumArgsInProto; i < NumArgs; i++) {
       ExprResult Arg = DefaultVariadicArgumentPromotion(Args[i], VariadicMethod, 0);
       IsError |= Arg.isInvalid();
       TheCall->setArg(i + 1, Arg.take());
diff --git a/test/SemaCXX/member-operator-expr.cpp b/test/SemaCXX/member-operator-expr.cpp
index ae5f8bb..c98ef73 100644
--- a/test/SemaCXX/member-operator-expr.cpp
+++ b/test/SemaCXX/member-operator-expr.cpp
@@ -27,3 +27,8 @@
   x->operator float(); // expected-error{{no member named 'operator float'}}
   x->operator; // expected-error{{expected a type}}
 }
+
+namespace pr13157 {
+  class A { public: void operator()(int x, int y = 2, ...) {} };
+  void f() { A()(1); }
+}
\ No newline at end of file