annotate gcc/testsuite/gcc.dg/decl-1.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Copyright (C) 2002 Free Software Foundation, Inc.
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 Source: Neil Booth, 12 Feb 2002.
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 In the declaration of proc, x must be parsed as a typedef name (C99
kono
parents:
diff changeset
6 6.7.5.3 p11. Also see C89 DR #009, which was erroneously omitted
kono
parents:
diff changeset
7 from C99, and resubmitted as DR #249: if in a parameter
kono
parents:
diff changeset
8 declaration, an identifier can be read as a typedef name or a
kono
parents:
diff changeset
9 paramter name, it is read as a typedef name). */
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 /* { dg-do compile } */
kono
parents:
diff changeset
12
kono
parents:
diff changeset
13 typedef int x;
kono
parents:
diff changeset
14 typedef int y;
kono
parents:
diff changeset
15 int proc(int (x)); /* x is a typedef, param to proc is a function. */
kono
parents:
diff changeset
16 int proc2(int x); /* x is an identifier, param is an int. */
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 /* Parameter to proc3 is unnamed, with type a function that returns
kono
parents:
diff changeset
19 int and takes a single argument of type function with one int
kono
parents:
diff changeset
20 parameter returning int. In particular, proc3 is not a function
kono
parents:
diff changeset
21 that takes a parameter y that is a function with one int parameter
kono
parents:
diff changeset
22 returning int. 8-) */
kono
parents:
diff changeset
23 int proc3(int (y (x)));
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 int main ()
kono
parents:
diff changeset
26 {
kono
parents:
diff changeset
27 proc (proc2); /* { dg-bogus "integer from pointer" } */
kono
parents:
diff changeset
28 return proc3 (proc); /* { dg-bogus "incompatible pointer type" } */
kono
parents:
diff changeset
29 }