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

llvm-svn: 160570
This commit is contained in:
Aaron Ballman 2012-07-20 20:40:35 +00:00
parent 66a00c765f
commit 9bca21ed25
2 changed files with 6 additions and 1 deletions

View 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());

View 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); }
}