summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/other/stdarg1.C
blob: 1ac9e8fb229ed906a8f2656932f061c98863e145 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;
}