OSDN Git Service

f852b08ce5ab23dd11a617a619980b850d4df854
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.other / vaarg3.C
1 // { dg-do assemble  }
2 // { dg-options "-Wno-abi" { target arm_eabi } }
3
4 // Copyright (C) 1999 Free Software Foundation, Inc.
5 // Contributed by Nathan Sidwell 4 Oct 1999 <nathan@acm.org>
6
7 // Make sure we diagnose bad uses of va_arg
8
9 #include <stdarg.h>
10
11 struct X {int m;};
12 struct Y : X {int m;};
13 struct Z;   // { dg-error "forward decl" } 
14 void fn1(va_list args)
15 {
16   int i = va_arg (args, int);
17   Y x = va_arg (args, Y);         // { dg-warning "cannot receive" } 
18   Y y = va_arg (args, struct Y);  // { dg-warning "cannot receive" } 
19   int &r = va_arg (args, int &);  // { dg-warning "cannot receive" } 
20   
21   Z z1 = va_arg (args, Z);        // { dg-error "incomplete" } 
22   const Z &z2 = va_arg (args, Z);       // { dg-error "incomplete" } 
23
24   va_arg (args, char);    // { dg-warning "promote" } 
25   // { dg-message "should pass" "pass" { target *-*-* } 24 }
26   // { dg-message "abort" "abort" { target *-*-* } 24 }
27   va_arg (args, int []);  // { dg-error "array with unspecified bounds" } promote
28   va_arg (args, int ());  // { dg-warning "non-POD" } promote
29   va_arg (args, bool);    // { dg-warning "promote" "promote" } 
30   // { dg-message "abort" "abort" { target *-*-* } 29 }
31 }