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