111
|
1 /* { dg-do compile } */
|
|
2 /* { dg-options "-Wc++-compat" } */
|
|
3
|
|
4 typedef struct A { int i; } B;
|
145
|
5 typedef struct T { int i; } *T; /* { dg-warning "using 'T' as both a typedef and a tag is invalid" } */
|
111
|
6 typedef const float TFA;
|
|
7 typedef TFA TFB;
|
|
8 typedef TFB TFC;
|
|
9 typedef int IA[];
|
|
10 typedef IA *IAP;
|
|
11 extern IAP arr[];
|
|
12
|
131
|
13 void fn1 (B *); /* { dg-message "expected 'B \\*' {aka 'struct A \\*'} but argument is of type 'struct B \\*'" } */
|
111
|
14 void fn2 (TFC *);
|
|
15
|
|
16 void
|
|
17 bar (B *b, int *i)
|
|
18 {
|
|
19 fn1 ((struct B *) b); /* { dg-warning "passing argument" } */
|
|
20 fn2 (i); /* { dg-warning "passing argument" } */
|
|
21 sizeof (arr); /* { dg-error "invalid application of .sizeof. to incomplete type .int \\(\\*\\\[\\\]\\)\\\[\\\]." } */
|
|
22 }
|
|
23
|
|
24 int
|
|
25 foo (void *a)
|
|
26 {
|
145
|
27 T t = a; /* { dg-warning "request for implicit conversion from 'void \\*' to 'T' {aka 'struct T \\*'} not" } */
|
111
|
28 return t->i;
|
|
29 }
|