annotate gcc/testsuite/gcc.dg/diag-aka-1.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do compile } */
kono
parents:
diff changeset
2 /* { dg-options "-Wc++-compat" } */
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 typedef struct A { int i; } B;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
5 typedef struct T { int i; } *T; /* { dg-warning "using 'T' as both a typedef and a tag is invalid" } */
111
kono
parents:
diff changeset
6 typedef const float TFA;
kono
parents:
diff changeset
7 typedef TFA TFB;
kono
parents:
diff changeset
8 typedef TFB TFC;
kono
parents:
diff changeset
9 typedef int IA[];
kono
parents:
diff changeset
10 typedef IA *IAP;
kono
parents:
diff changeset
11 extern IAP arr[];
kono
parents:
diff changeset
12
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
13 void fn1 (B *); /* { dg-message "expected 'B \\*' {aka 'struct A \\*'} but argument is of type 'struct B \\*'" } */
111
kono
parents:
diff changeset
14 void fn2 (TFC *);
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 void
kono
parents:
diff changeset
17 bar (B *b, int *i)
kono
parents:
diff changeset
18 {
kono
parents:
diff changeset
19 fn1 ((struct B *) b); /* { dg-warning "passing argument" } */
kono
parents:
diff changeset
20 fn2 (i); /* { dg-warning "passing argument" } */
kono
parents:
diff changeset
21 sizeof (arr); /* { dg-error "invalid application of .sizeof. to incomplete type .int \\(\\*\\\[\\\]\\)\\\[\\\]." } */
kono
parents:
diff changeset
22 }
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 int
kono
parents:
diff changeset
25 foo (void *a)
kono
parents:
diff changeset
26 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
27 T t = a; /* { dg-warning "request for implicit conversion from 'void \\*' to 'T' {aka 'struct T \\*'} not" } */
111
kono
parents:
diff changeset
28 return t->i;
kono
parents:
diff changeset
29 }