]> granicus.if.org Git - clang/commitdiff
No longer assuming the number of prototype arguments is always less than the number...
authorAaron Ballman <aaron@aaronballman.com>
Fri, 20 Jul 2012 20:40:35 +0000 (20:40 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Fri, 20 Jul 2012 20:40:35 +0000 (20:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160570 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOverload.cpp
test/SemaCXX/member-operator-expr.cpp

index 9420b73d8b8f54e4a775f583194863de1db624df..b80e374b60765425327462569ac4e0002ae46fa8 100644 (file)
@@ -10998,7 +10998,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
   // 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());
index ae5f8bb0ddb69f252baa52c81b7ca96a59fbf2f2..c98ef7399709cd3b82baf2f135d7bbfdf56a6352 100644 (file)
@@ -27,3 +27,8 @@ void test2() {
   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