Fixed bug in return type of __builtin_va_start().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194197 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index b1da24b..5fe2d03 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -1651,6 +1651,7 @@
Diag(ParamLoc, diag::note_parameter_type) << Type;
}
+ TheCall->setType(Context.VoidTy);
return false;
}
diff --git a/test/Sema/varargs.c b/test/Sema/varargs.c
index 663d3d5..5329c2e 100644
--- a/test/Sema/varargs.c
+++ b/test/Sema/varargs.c
@@ -76,3 +76,10 @@
(void)__builtin_va_arg(args, short); // expected-warning {{second argument to 'va_arg' is of promotable type 'short'}}
(void)__builtin_va_arg(args, char); // expected-warning {{second argument to 'va_arg' is of promotable type 'char'}}
}
+
+void f10(int a, ...) {
+ int i;
+ __builtin_va_list ap;
+ i = __builtin_va_start(ap, a); // expected-error {{assigning to 'int' from incompatible type 'void'}}
+ __builtin_va_end(ap);
+}