| 1 |
/* PR c/56980 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
|
| 4 |
typedef struct A { int i; } B; |
| 5 |
typedef union U { int i; } V; |
| 6 |
typedef enum E { G } F; |
| 7 |
|
| 8 |
void foo_s (struct A); /* { dg-message "expected .struct A. but argument is of type 'B \\*' {aka 'struct A \\*'}" } */ |
| 9 |
void foo_u (union U); /* { dg-message "expected .union U. but argument is of type 'V \\*' {aka 'union U \\*'}" } */ |
| 10 |
void foo_e (enum E); /* { dg-message "expected .enum E. but argument is of type 'F \\*' {aka 'enum E \\*'}" } */ |
| 11 |
void foo_sp (B *); /* { dg-message "expected 'B \\*' {aka 'struct A \\*'} but argument is of type .struct B \\*." } */ |
| 12 |
void foo_up (V *); /* { dg-message "expected 'V \\*' {aka 'union U \\*'} but argument is of type .union V \\*." } */ |
| 13 |
void foo_ep (F *); /* { dg-message "expected 'F \\*' {aka 'enum E \\*'} but argument is of type .enum F \\*." } */ |
| 14 |
|
| 15 |
void |
| 16 |
bar (B *b, V *v, F *f) |
| 17 |
{ |
| 18 |
foo_s (b); /* { dg-error "incompatible" } */ |
| 19 |
foo_u (v); /* { dg-error "incompatible" } */ |
| 20 |
foo_e (f); /* { dg-error "incompatible" } */ |
| 21 |
foo_sp ((struct B *) b); /* { dg-error "passing argument" } */ |
| 22 |
foo_up ((union V *) v); /* { dg-error "passing argument" } */ |
| 23 |
foo_ep (__extension__ (enum F *) f); /* { dg-error "passing argument" } */ |
| 24 |
} |