]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/g++.old-deja/g++.other/vaarg3.C
re PR libstdc++/37907 ([c++0x] support for std::is_standard_layout)
[thirdparty/gcc.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 { Y(const Y&); };
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-error "cannot receive" }
18 Y y = va_arg (args, struct Y); // { dg-error "cannot receive" }
19 int &r = va_arg (args, int &); // { dg-error "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 "promoted" } promote
29 // { dg-message "abort" "abort" { target *-*-* } 28 }
30 va_arg (args, bool); // { dg-warning "promote" "promote" }
31 // { dg-message "abort" "abort" { target *-*-* } 30 }
32 }