diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr56980.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/pr56980.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr56980.c b/gcc/testsuite/gcc.dg/pr56980.c new file mode 100644 index 0000000..f48379a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr56980.c @@ -0,0 +1,24 @@ +/* PR c/56980 */ +/* { dg-do compile } */ + +typedef struct A { int i; } B; +typedef union U { int i; } V; +typedef enum E { G } F; + +void foo_s (struct A); /* { dg-message "expected .struct A. but argument is of type .B \\*." } */ +void foo_u (union U); /* { dg-message "expected .union U. but argument is of type .V \\*." } */ +void foo_e (enum E); /* { dg-message "expected .enum E. but argument is of type .F \\*." } */ +void foo_sp (B *); /* { dg-message "expected .B \\*. but argument is of type .struct B \\*." } */ +void foo_up (V *); /* { dg-message "expected .V \\*. but argument is of type .union V \\*." } */ +void foo_ep (F *); /* { dg-message "expected .F \\*. but argument is of type .enum F \\*." } */ + +void +bar (B *b, V *v, F *f) +{ + foo_s (b); /* { dg-error "incompatible" } */ + foo_u (v); /* { dg-error "incompatible" } */ + foo_e (f); /* { dg-error "incompatible" } */ + foo_sp ((struct B *) b); /* { dg-error "passing argument" } */ + foo_up ((union V *) v); /* { dg-error "passing argument" } */ + foo_ep (__extension__ (enum F *) f); /* { dg-error "passing argument" } */ +} |