summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/other/stdarg1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/other/stdarg1.C')
-rw-r--r--gcc/testsuite/g++.dg/other/stdarg1.C27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/other/stdarg1.C b/gcc/testsuite/g++.dg/other/stdarg1.C
new file mode 100644
index 000000000..1ac9e8fb2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/stdarg1.C
@@ -0,0 +1,27 @@
+// Test stdarg function with anonymous argument
+// { dg-do run }
+// { dg-options "-Wno-abi" { target arm_eabi } }
+
+#include <stdarg.h>
+
+extern "C" void abort (void);
+
+void baz (va_list list)
+{
+ if (va_arg (list, long) != 3)
+ abort ();
+}
+
+void foo (long p1, long, long p2, ...)
+{
+ va_list list;
+ va_start (list, p2);
+ baz (list);
+ va_end (list);
+}
+
+int main ()
+{
+ foo (0, 1, 2, (long)3);
+ return 0;
+}