Fix va_arg bug noticed by Eli, __builtin_va_arg is not an l-value
designating an object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64371 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/varargs.c b/test/Sema/varargs.c
index ae21c20..b340177 100644
--- a/test/Sema/varargs.c
+++ b/test/Sema/varargs.c
@@ -52,3 +52,11 @@
__builtin_va_end (authors);
}
+void f7(int a, ...) {
+ __builtin_va_list ap;
+ __builtin_va_start(ap, a);
+ // FIXME: This error message is sub-par.
+ __builtin_va_arg(ap, int) = 1; // expected-error {{non-object type 'int' is not assignable}}
+ int *x = &__builtin_va_arg(ap, int); // expected-error {{address expression must be an lvalue or a function designator}}
+ __builtin_va_end(ap);
+}