| 1 |
/* Test GNU parameter forward declarations. */ |
| 2 |
/* Origin: Joseph Myers <[email protected]> */ |
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-options "" } */ |
| 5 |
|
| 6 |
/* Valid uses. */ |
| 7 |
int f1(int a; int a); |
| 8 |
int f2(int a; int a) { return 0; } |
| 9 |
int f3(int a; int a; int a); |
| 10 |
int f4(int a; int a; int a) { return 0; } |
| 11 |
int f5(int a; int (*x)[a], int a); |
| 12 |
int f6(int a; int (*x)[a], int a) { return 0; } |
| 13 |
int f7(int a; int (*x)[a]; int (*y)[x[1][2]], int (*x)[a], int a); |
| 14 |
int f8(int a; int (*x)[a]; int (*y)[x[1][2]], int (*x)[a], int a) { return 0; } |
| 15 |
|
| 16 |
/* Strange uses accepted by GCC 4.0 but not by 3.4 and probably not |
| 17 |
desirable to accept. */ |
| 18 |
int g1(int a;); /* { dg-error "just a forward declaration" "no parms" { xfail *-*-* } } */ |
| 19 |
int g2(int a; __attribute__((unused))); /* { dg-error "just a forward declaration" "no parms" { xfail *-*-* } } */ |
| 20 |
int g3(int;); /* { dg-error "just a forward declaration" "no parms" { xfail *-*-* } } */ |
| 21 |
int g4(int, long;); /* { dg-error "just a forward declaration" "no parms" { xfail *-*-* } } */ |
| 22 |
|
| 23 |
/* Invalid uses. */ |
| 24 |
int h1(int a; int b); /* { dg-error "just a forward declaration" } */ |
| 25 |
int h2(int; int b); /* { dg-error "just a forward declaration" } */ |
| 26 |
int h3(int a; long a); /* { dg-error "conflicting types|previous definition|just a forward declaration" } */ |