]>
Commit | Line | Data |
---|---|---|
2d51fcef MP |
1 | /* { dg-do compile } */ |
2 | /* { dg-options "-Wc++-compat" } */ | |
3 | ||
4 | typedef struct A { int i; } B; | |
55879815 | 5 | typedef struct T { int i; } *T; /* { dg-warning "using 'T' as both a typedef and a tag is invalid" } */ |
2d51fcef MP |
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 | ||
ce95abc4 | 13 | void fn1 (B *); /* { dg-message "expected 'B \\*' {aka 'struct A \\*'} but argument is of type 'struct B \\*'" } */ |
2d51fcef MP |
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 | { | |
55879815 | 27 | T t = a; /* { dg-warning "request for implicit conversion from 'void \\*' to 'T' {aka 'struct T \\*'} not" } */ |
2d51fcef MP |
28 | return t->i; |
29 | } |